home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------
-
- Module name: Phinter.
-
- Author: Toby Howard.
-
- Function: PHIGS textual interpreter.
-
- Internal function list: readstring, readinteger, readreal,
- readphigsenum, interpreter, popen_phigs.
-
- External function list: ptk_phinter.
-
- Hashtables used: "structureid".
-
- Modification history: (Version), (Date), (Name), (Description).
-
- 1.0, May 1986, Toby Howard, First version.
-
- 1.1, Jan 1988, Manjula Patel, PHIGS+ additions.
-
- 1.2, 14th July 1988, Steve Larkin, Modified to use Vax PHIGS$
- and a pascal binding in 'pbind.pas'.
-
- 2.0, May 1991, Gareth Williams, Converted to C.
-
- 2.1, June 1991, Gareth Williams, Completed handling of all PHIGS functions.
-
- 3.0, June 1992, Gareth Williams, Converted to ISO PHIGS C.
-
- 3.1, July 1992, Gareth Williams, Added PHIGS PLUS bits for SunPHIGS 2.0.
-
- 3.2, August 1992, Gareth Williams, Added bits to work with HP PHIGS 2.2.
-
- ----------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <math.h>
- #include <varargs.h>
- #include <setjmp.h>
- #include <ctype.h>
- #ifdef SUN
- #include <string.h>
- #include <strings.h>
- #endif
- #ifdef PEXSI
- #include <string.h>
- #include <strings.h>
- #endif
- #include <phigs.h>
- #include "ptk.h"
-
- /*--------------------------------------------------------------------------*/
-
- #define CURRENTVERSION 3.1
-
- #define phintermessage " (September, 1992)"
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- #define MAXPHIGSNAMES 424 /* 319 (PHIGS) + 105 (PHIGS PLUS) */
- #else
- #define MAXPHIGSNAMES 319 /* number of phigs function names */
- #endif
-
- #define default_prompt_string "phinter"
-
- /*--------------------------------------------------------------------------*/
-
- /* PHIGS PLUS bits */
- typedef enum
- {
- PTKEADDNAMESET,
- PTKEANNOTATIONTEXTRELATIVE,
- PTKEANNOTATIONTEXTRELATIVE3,
- PTKEAPPLICATIONDATA,
- PTKEARALLSTRUCT,
- PTKEARSTRUCT,
- PTKEARSTRUCTNET,
- PTKEAWAITEVENT,
- PTKEBUILDTRAN,
- PTKEBUILDTRAN3,
- PTKECELLARRAY,
- PTKECELLARRAY3,
- PTKECHANGESTRUCTID,
- PTKECHANGESTRUCTIDREF,
- PTKECHANGESTRUCTREF,
- PTKECLOSEARFILE,
- PTKECLOSEPHIGS,
- PTKECLOSESTRUCT,
- PTKECLOSEWS,
- PTKECOMPOSEMATRIX,
- PTKECOMPOSEMATRIX3,
- PTKECOMPOSETRAN,
- PTKECOMPOSETRAN3,
- PTKECOPYALLELEMSSTRUCT,
- PTKEDELALLSTRUCT,
- PTKEDELALLSTRUCTAR,
- PTKEDELELEM,
- PTKEDELELEMRANGE,
- PTKEDELELEMSLABELS,
- PTKEDELSTRUCT,
- PTKEDELSTRUCTNET,
- PTKEDELSTRUCTNETAR,
- PTKEDELSTRUCTAR,
- PTKEELEMSRCH,
- PTKEEMERGENCYCLOSEPHIGS,
- PTKEEMPTYSTRUCT,
- PTKEERRORHAND,
- PTKEERRORLOG,
- PTKEESCAPE,
- PTKEEVALVIEWMAPPINGMATRIX,
- PTKEEVALVIEWMAPPINGMATRIX3,
- PTKEEVALVIEWORIENTATIONMATRIX,
- PTKEEVALVIEWORIENTATIONMATRIX3,
- PTKEEXECUTESTRUCT,
- PTKEFILLAREA,
- PTKEFILLAREA3,
- PTKEFILLAREASET,
- PTKEFILLAREASET3,
- PTKEFLUSHEVENTS,
- PTKEGDP,
- PTKEGDP3,
- PTKEGSE,
- PTKEGETCHOICE,
- PTKEGETTYPEMF,
- PTKEGETLOC,
- PTKEGETLOC3,
- PTKEGETPICK,
- PTKEGETSTRING,
- PTKEGETSTROKE,
- PTKEGETSTROKE3,
- PTKEGETVAL,
- PTKEINCRSPASRCH,
- PTKEINCRSPASRCH3,
- PTKEINITCHOICE,
- PTKEINITCHOICE3,
- PTKEINITLOC,
- PTKEINITLOC3,
- PTKEINITPICK,
- PTKEINITPICK3,
- PTKEINITSTRING,
- PTKEINITSTRING3,
- PTKEINITSTROKE,
- PTKEINITSTROKE3,
- PTKEINITVAL,
- PTKEINITVAL3,
- PTKEINQALLCONFSTRUCT,
- PTKEINQANNOTATIONFACIL,
- PTKEINQARFILES,
- PTKEINQARST,
- PTKEINQCHOICEST,
- PTKEINQCHOICEST3,
- PTKEINQCOLOURFACIL,
- PTKEINQCOLOURMODEL,
- PTKEINQCOLOURMODELFACIL,
- PTKEINQCOLOURREP,
- PTKEINQCONFRES,
- PTKEINQCONFSTRUCTINNET,
- PTKEINQCURELEMCONTENT,
- PTKEINQCURELEMTYPESIZE,
- PTKEINQDEFCHOICEDATA,
- PTKEINQDEFCHOICEDATA3,
- PTKEINQDEFDISPLAYUPDATEST,
- PTKEINQDEFLOCDATA,
- PTKEINQDEFLOCDATA3,
- PTKEINQDEFPICKDATA,
- PTKEINQDEFPICKDATA3,
- PTKEINQDEFSTRINGDATA,
- PTKEINQDEFSTRINGDATA3,
- PTKEINQDEFSTROKEDATA,
- PTKEINQDEFSTROKEDATA3,
- PTKEINQDEFVALDATA,
- PTKEINQDEFVALDATA3,
- PTKEINQDISPLAYSPACESIZE,
- PTKEINQDISPLAYSPACESIZE3,
- PTKEINQDISPLAYUPDATEST,
- PTKEINQDYNSTRUCT,
- PTKEINQDYNWSATTR,
- PTKEINQEDGEFACIL,
- PTKEINQEDGEREP,
- PTKEINQEDITMODE,
- PTKEINQELEMCONTENT,
- PTKEINQELEMPTR,
- PTKEINQELEMTYPESIZE,
- PTKEINQERRORHANDMODE,
- PTKEINQGDP,
- PTKEINQGDP3,
- PTKEINQGSEFACIL,
- PTKEINQHILIGHTFILTER,
- PTKEINQHLHSRFACIL,
- PTKEINQHLHSRMODE,
- PTKEINQINPUTOVERFLOW,
- PTKEINQINTFACIL,
- PTKEINQINTREP,
- PTKEINQINVISFILTER,
- PTKEINQAVAILGDP,
- PTKEINQAVAILGDP3,
- PTKEINQGSE,
- PTKEINQWSTYPES,
- PTKEINQCOLOURIND,
- PTKEINQEDGEIND,
- PTKEINQINTIND,
- PTKEINQPATIND,
- PTKEINQLINEIND,
- PTKEINQMARKERIND,
- PTKEINQTEXTIND,
- PTKEINQVIEWIND,
- PTKEINQLOCST,
- PTKEINQLOCST3,
- PTKEINQMODELCLIPFACIL,
- PTKEINQMOREEVENTS,
- PTKEINQNUMINPUT,
- PTKEINQNUMDISPLAYPRI,
- PTKEINQOPENSTRUCT,
- PTKEINQANCESSTRUCT,
- PTKEINQDESCSTRUCT,
- PTKEINQPATFACIL,
- PTKEINQPATREP,
- PTKEINQPHIGSFACIL,
- PTKEINQPICKST,
- PTKEINQPICKST3,
- PTKEINQLINEFACIL,
- PTKEINQLINEREP,
- PTKEINQMARKERFACIL,
- PTKEINQMARKERREP,
- PTKEINQPOSTEDSTRUCT,
- PTKEINQPREDCOLOURREP,
- PTKEINQPREDEDGEREP,
- PTKEINQPREDINTREP,
- PTKEINQPREDPATREP,
- PTKEINQPREDLINEREP,
- PTKEINQPREDMARKERREP,
- PTKEINQPREDTEXTREP,
- PTKEINQPREDVIEWREP,
- PTKEINQSETOPENWS,
- PTKEINQSETWSPOSTED,
- PTKEINQSTRINGST,
- PTKEINQSTRINGST3,
- PTKEINQSTROKEST,
- PTKEINQSTROKEST3,
- PTKEINQSTRUCTIDS,
- PTKEINQSTRUCTST,
- PTKEINQSTRUCTSTATUS,
- PTKEINQSYSTEMST,
- PTKEINQTEXTEXTENT,
- PTKEINQTEXTFACIL,
- PTKEINQTEXTREP,
- PTKEINQVALST,
- PTKEINQVALST3,
- PTKEINQVIEWFACIL,
- PTKEINQVIEWREP,
- PTKEINQWSCATEGORY,
- PTKEINQWSCLASS,
- PTKEINQWSCONNTYPE,
- PTKEINQWSST,
- PTKEINQWSSTTABLE,
- PTKEINQWSTRAN,
- PTKEINQWSTRAN3,
- PTKEINTERPRET,
- PTKELABEL,
- PTKEMESSAGE,
- PTKEOFFSETELEMPTR,
- PTKEOPENARFILE,
- PTKEOPENPHIGS,
- PTKEOPENSTRUCT,
- PTKEOPENWS,
- PTKEPOLYLINE,
- PTKEPOLYLINE3,
- PTKEPOLYMARKER,
- PTKEPOLYMARKER3,
- PTKEPOSTSTRUCT,
- PTKEREADMF,
- PTKEREDRAWALLSTRUCT,
- PTKEREMOVENAMESET,
- PTKEREQCHOICE,
- PTKEREQLOC,
- PTKEREQLOC3,
- PTKEREQPICK,
- PTKEREQSTRING,
- PTKEREQSTROKE,
- PTKEREQSTROKE3,
- PTKEREQVAL,
- PTKERESTOREMODELCLIPVOLUME,
- PTKERETRIEVEALLSTRUCT,
- PTKERETRIEVEANCESSTRUCT,
- PTKERETRIEVEDESCSTRUCT,
- PTKERETRIEVESTRUCTIDS,
- PTKERETRIEVESTRUCT,
- PTKERETRIEVESTRUCTNET,
- PTKEROTATE,
- PTKEROTATEX,
- PTKEROTATEY,
- PTKEROTATEZ,
- PTKESAMPLECHOICE,
- PTKESAMPLELOC,
- PTKESAMPLELOC3,
- PTKESAMPLEPICK,
- PTKESAMPLESTRING,
- PTKESAMPLESTROKE,
- PTKESAMPLESTROKE3,
- PTKESAMPLEVAL,
- PTKESCALE,
- PTKESCALE3,
- #ifdef SUN
- PTKESETEDGECOLR,
- PTKESETINTCOLR,
- PTKESETLINECOLR,
- PTKESETMARKERCOLR,
- PTKESETTEXTCOLR,
- #endif
- PTKESETANNOTATIONSTYLE,
- PTKESETANNOTATIONALIGN,
- PTKESETANNOTATIONCHARHEIGHT,
- PTKESETANNOTATIONCHARUP,
- PTKESETANNOTATIONPATH,
- PTKESETCHAREXPAN,
- PTKESETCHARHEIGHT,
- PTKESETCHARSPACE,
- PTKESETCHARUP,
- PTKESETCHOICEMODE,
- PTKESETCOLOURMODEL,
- PTKESETCOLOURREP,
- PTKESETCONFRES,
- PTKESETDISPLAYUPDATEST,
- PTKESETEDGECOLOURIND,
- PTKESETEDGEFLAG,
- PTKESETEDGEIND,
- PTKESETEDGEREP,
- PTKESETEDGETYPE,
- PTKESETEDGEWIDTH,
- PTKESETEDITMODE,
- PTKESETELEMPTR,
- PTKESETELEMPTRLABEL,
- PTKESETERRORHANDMODE,
- PTKESETGLOBALTRAN,
- PTKESETGLOBALTRAN3,
- PTKESETHILIGHTFILTER,
- PTKESETHLHSRID,
- PTKESETHLHSRMODE,
- PTKESETINDIVASF,
- PTKESETINTCOLOURIND,
- PTKESETINTIND,
- PTKESETINTREP,
- PTKESETINTSTYLE,
- PTKESETINTSTYLEIND,
- PTKESETINVISFILTER,
- PTKESETLINETYPE,
- PTKESETLINEWIDTH,
- PTKESETLOCALTRAN,
- PTKESETLOCALTRAN3,
- PTKESETLOCMODE,
- PTKESETMARKERSIZE,
- PTKESETMARKERTYPE,
- PTKESETMODELCLIPINDICATOR,
- PTKESETMODELCLIPVOLUME,
- PTKESETMODELCLIPVOLUME3,
- PTKESETPATREFPT,
- PTKESETPATREFPTVECTORS,
- PTKESETPATREP,
- PTKESETPATSIZE,
- PTKESETPICKFILTER,
- PTKESETPICKID,
- PTKESETPICKMODE,
- PTKESETLINECOLOURIND,
- PTKESETLINEIND,
- PTKESETLINEREP,
- PTKESETMARKERCOLOURIND,
- PTKESETMARKERIND,
- PTKESETMARKERREP,
- PTKESETSTRINGMODE,
- PTKESETSTROKEMODE,
- PTKESETTEXTALIGN,
- PTKESETTEXTCOLOURIND,
- PTKESETTEXTFONT,
- PTKESETTEXTIND,
- PTKESETTEXTPATH,
- PTKESETTEXTPREC,
- PTKESETTEXTREP,
- PTKESETVALMODE,
- PTKESETVIEWIND,
- PTKESETVIEWREP,
- PTKESETVIEWREP3,
- PTKESETVIEWTRANINPUTPRI,
- PTKESETWSVIEWPORT,
- PTKESETWSVIEWPORT3,
- PTKESETWSWINDOW,
- PTKESETWSWINDOW3,
- PTKETEXT,
- PTKETEXT3,
- PTKETRANPT,
- PTKETRANPT3,
- PTKETRANSLATE,
- PTKETRANSLATE3,
- PTKEUNPOSTALLSTRUCT,
- PTKEUNPOSTSTRUCT,
- PTKEUPDATEWS,
- PTKEWRITEMF,
- #ifdef SUN
- PTKECELLARRAY3PLUS,
- PTKECOMPFILLAREASETGNORM,
- PTKEFILLAREASETDATA,
- PTKEFILLAREASET3DATA,
- PTKEINQCOLRMAPFACS,
- PTKEINQCOLRMAPMETHODFACS,
- PTKEINQCOLRMAPREP,
- PTKEINQCOLRMAPST,
- PTKEINQCURVSURFFACS,
- PTKEINQDATAMAPFACS,
- PTKEINQDATAMAPREP,
- PTKEINQDCUEFACS,
- PTKEINQDCUEREP,
- PTKEINQDIRECTCOLRMODELFACS,
- PTKEINQDYNSWSATTRSPLUS,
- PTKEINQEDGEREPPLUS,
- PTKEINQINTFACSPLUS,
- PTKEINQINTREPPLUS,
- PTKEINQLIGHTSRCFACS,
- PTKEINQLIGHTSRCREP,
- PTKEINQLISTCOLRMAPINDS,
- PTKEINQLISTDATAMAPINDS,
- PTKEINQLISTDCUEINDS,
- PTKEINQLISTLIGHTSRCINDS,
- PTKEINQLISTPARAMSURFINDS,
- PTKEINQLISTREFLINDS,
- PTKEINQPARAMSURFREP,
- PTKEINQPATREPPLUS,
- PTKEINQLINEFACSPLUS,
- PTKEINQLINEREPPLUS,
- PTKEINQMARKERREPPLUS,
- PTKEINQPREDCOLRMAPREP,
- PTKEINQPREDDATAMAPREP,
- PTKEINQPREDDCUEREP,
- PTKEINQPREDEDGEREPPLUS,
- PTKEINQPREDINTREPPLUS,
- PTKEINQPREDLIGHTSRCREP,
- PTKEINQPREDPARAMSURFREP,
- PTKEINQPREDPATREPPLUS,
- PTKEINQPREDLINEREPPLUS,
- PTKEINQPREDMARKERREPPLUS,
- PTKEINQPREDREFLREP,
- PTKEINQPREDTEXTREPPLUS,
- PTKEINQREFLFACS,
- PTKEINQREFLREP,
- PTKEINQRENDERINGCOLRMODELFACS,
- PTKEINQTEXTREPPLUS,
- PTKEINQWSSTTABLEPLUS,
- PTKENUNIBSPLCURV,
- PTKENUNIBSPLCURVCOLR,
- PTKENUNIBSPLSURF,
- PTKENUNIBSPLSURFDATA,
- PTKEPOLYLINESET3DATA,
- PTKEQUADMESHDATA,
- PTKEQUADMESH3DATA,
- PTKESETBACKDATAMAPIND,
- PTKESETBACKDATAMAPMETH,
- PTKESETBACKINTCOLR,
- PTKESETBACKINTIND,
- PTKESETBACKINTSHADMETH,
- PTKESETBACKINTSTYLE,
- PTKESETBACKINTSTYLEIND,
- PTKESETBACKREFLIND,
- PTKESETBACKREFLMODEL,
- PTKESETBACKREFLPROPS,
- PTKESETCOLRMAPIND,
- PTKESETCOLRMAPREP,
- PTKESETCURVAPPROX,
- PTKESETDATAMAPIND,
- PTKESETDATAMAPMETH,
- PTKESETDATAMAPREP,
- PTKESETDCUEIND,
- PTKESETDCUEREP,
- PTKESETEDGEREPPLUS,
- PTKESETFACECULLMODE,
- PTKESETFACEDISTINGMODE,
- PTKESETINTREPPLUS,
- PTKESETINTSHADMETH,
- PTKESETLIGHTSRCREP,
- PTKESETLIGHTSRCSTATE,
- PTKESETOFFILLAREASETDATA,
- PTKESETOFFILLAREASET3DATA,
- PTKESETPARAMSURFCHARACS,
- PTKESETPARAMSURFIND,
- PTKESETPARAMSURFREP,
- PTKESETPATREPPLUS,
- PTKESETLINEREPPLUS,
- PTKESETLINESHADMETH,
- PTKESETMARKERREPPLUS,
- PTKESETREFLIND,
- PTKESETREFLMODEL,
- PTKESETREFLPROPS,
- PTKESETREFLREP,
- PTKESETRENDERINGCOLRMODEL,
- PTKESETSURFAPPROX,
- PTKESETTEXTREPPLUS,
- PTKETRISETDATA,
- PTKETRISET3DATA,
- PTKETRISTRIPDATA,
- PTKETRISTRIP3DATA
- #endif
- } ptkephigsnames;
-
- /* PHIGS PLUS bits */
- typedef enum
- {
- PTKEWSDEP,
- PTKESYSTEMSTATE,
- PTKEWSSTATE,
- PTKESTRUCTSTATE,
- PTKESTRUCTSTATUS,
- PTKEARCHIVESTATE,
- PTKEWSCLASS,
- PTKEWSCAT,
- PTKECONTROL,
- PTKEREGEN,
- PTKEDEFMODE,
- PTKEMOD,
- PTKESIMULTEV,
- PTKESTRUCTNETSRC,
- PTKEDSPSURF,
- PTKEVISUALREP,
- PTKETXPREC,
- PTKETXPATH,
- PTKETXHOR,
- PTKETXVER,
- PTKEINTERSTYLE,
- PTKEEDGEF,
- PTKEATTRID,
- PTKEASF,
- PTKECOAVAIL,
- PTKECOMPTYPE,
- PTKEPROJTYPE,
- PTKECLIP,
- PTKEVPRI,
- PTKECONFRES,
- PTKEPFCF,
- PTKEPATHORDER,
- PTKEIMODE,
- PTKEESW,
- PTKEISTATUS,
- PTKEOPENSTRUCTSTATUS,
- PTKEICLASS,
- PTKEPRF,
- PTKEINQTYPE,
- PTKEUPDATEST,
- PTKEDEVUNITS,
- PTKEMODTYPE,
- PTKEATTRS,
- PTKEELTYPE,
- PTKEEDITMODE,
- PTKEREFF,
- PTKEERRORMODE,
- PTKESRCHDIR,
- PTKESRCHSTATUS,
- PTKESRCHELTYPE,
- #ifdef SUN
- PTKEBASENAME,
- PTKEWSTYPEATTR,
- PTKEACCUSAGE,
- PTKEDBLBUFF,
- PTKECURSORTYPE,
- PTKECOLOURMODE,
- PTKECGMENCODING,
- PTKECGMCONFORMANCE,
- PTKECGMVDCPRECISION,
- PTKEBGCLEAR,
- PTKEUSEDECOMP,
- PTKEDCMODEL,
- PTKESIMULATEPICK,
- #endif
- #ifdef PEXSI
- PTKEBASENAME,
- PTKEWSTYPEATTR,
- PTKEACCUSAGE,
- PTKEDBLBUFF,
- PTKECURSORTYPE,
- PTKECOLOURMODE,
- PTKECGMENCODING,
- PTKECGMCONFORMANCE,
- PTKECGMVDCPRECISION,
- PTKEBGCLEAR,
- PTKEUSEDECOMP,
- PTKEDCMODEL,
- PTKESIMULATEPICK,
- #endif
- #ifdef SUN
- PTKEDCUEMODE,
- PTKERATIONAL,
- PTKECULLMODE,
- PTKEDISTINGMODE,
- PTKECURVEPLACE
- #endif
- } ptkephigsenum;
-
- #ifdef SUN
- typedef enum
- {
- BASE_NAME,
- DOUBLE_BUFFER,
- NORM_CURSOR_TYPE,
- NORM_CURSOR_COLOUR,
- TRAV_CURSOR_TYPE,
- TRAV_CURSOR_COLOUR,
- ACCELERATOR_USAGE,
- COLOUR_MODE,
- TOOL_WIDTH,
- TOOL_HEIGHT,
- TOOL_X,
- TOOL_Y,
- TOOL_LABEL,
- TOOL_ICON_FILE,
- TOOL_FOREGROUND_COLOUR,
- TOOL_BACKGROUND_COLOUR,
- TOOL_SHOW_LABEL,
- TOOL_ICON_LABEL,
- TOOL_BORDER_WIDTH,
- WS_CATEGORY,
- COLOUR_TABLE_SIZE,
- WST_NUM_VIEW_REP,
- X_CMAP_PROP_ATOM,
- DC_MODEL,
- SIMULATE_PICK,
- STEREO,
- X_DISPLAY_NAME,
- CGM_ENCODING,
- CGM_CONFORMANCE,
- CGM_METRIC_HEIGHT_PTR,
- CGM_METRIC_WIDTH_PTR,
- CGM_METRIC_LINE_WIDTH_PTR,
- CGM_VDC_PRECISION,
- REGION_RECT,
- REGION_PRIORITY,
- REGION_BACKGROUND,
- USE_DECOMP
- } ptkewstypeattr;
- #endif
-
- #ifdef PEXSI
- typedef enum
- {
- BASE_NAME,
- DOUBLE_BUFFER,
- NORM_CURSOR_TYPE,
- NORM_CURSOR_COLOUR,
- TRAV_CURSOR_TYPE,
- TRAV_CURSOR_COLOUR,
- ACCELERATOR_USAGE,
- COLOUR_MODE,
- TOOL_WIDTH,
- TOOL_HEIGHT,
- TOOL_X,
- TOOL_Y,
- TOOL_LABEL,
- TOOL_ICON_FILE,
- TOOL_FOREGROUND_COLOUR,
- TOOL_BACKGROUND_COLOUR,
- TOOL_SHOW_LABEL,
- TOOL_ICON_LABEL,
- TOOL_BORDER_WIDTH,
- WS_CATEGORY,
- COLOUR_TABLE_SIZE,
- WST_NUM_VIEW_REP,
- X_CMAP_PROP_ATOM,
- DC_MODEL,
- SIMULATE_PICK,
- STEREO,
- X_DISPLAY_NAME,
- CGM_ENCODING,
- CGM_CONFORMANCE,
- CGM_METRIC_HEIGHT_PTR,
- CGM_METRIC_WIDTH_PTR,
- CGM_METRIC_LINE_WIDTH_PTR,
- CGM_VDC_PRECISION,
- REGION_RECT,
- REGION_PRIORITY,
- REGION_BACKGROUND,
- USE_DECOMP
- } ptkewstypeattr;
- #endif
-
- typedef enum
- {
- EXITERR, WARNING, INFORM, POPREQ
- } ptkeseverity;
-
- typedef enum ptkehashtable
- {
- PTKESTRUCTID,
- PTKEPICKID,
- PTKELABELVAL,
- PTKEVIEWIND,
- PTKECOLOURIND,
- PTKENAME,
- PTKENOTABLE
- } ptkehashtable;
-
- typedef enum ptkedest
- {
- PTKEOUTPUT,
- PTKEINFORM,
- PTKESTDOUT
- } ptkedest;
-
- /*-------------------------- static variables ------------------------------*/
-
- /* PHIGS PLUS bits */
- static char *phigsnamelist[MAXPHIGSNAMES] =
- {
- "add_names_to_set",
- "annotation_text_relative",
- "annotation_text_relative3",
- "application_data",
- "archive_all_structures",
- "archive_structures",
- "archive_structure_networks",
- "await_event",
- "build_transformation_matrix",
- "build_transformation_matrix3",
- "cell_array",
- "cell_array3",
- "change_structure_identifier",
- "change_structure_identifier_and_references",
- "change_structure_references",
- "close_archive_file",
- "close_phigs",
- "close_structure",
- "close_workstation",
- "compose_matrix",
- "compose_matrix3",
- "compose_transformation_matrix",
- "compose_transformation_matrix3",
- "copy_all_elements_from_structure",
- "delete_all_structures",
- "delete_all_structures_from_archive",
- "delete_element",
- "delete_element_range",
- "delete_elements_between_labels",
- "delete_structure",
- "delete_structure_network",
- "delete_structure_networks_from_archive",
- "delete_structures_from_archive",
- "element_search",
- "emergency_close_phigs",
- "empty_structure",
- "error_handling",
- "error_logging",
- "escape",
- "evaluate_view_mapping_matrix",
- "evaluate_view_mapping_matrix3",
- "evaluate_view_orientation_matrix",
- "evaluate_view_orientation_matrix3",
- "execute_structure",
- "fill_area",
- "fill_area3",
- "fill_area_set",
- "fill_area_set3",
- "flush_device_events",
- "generalized_drawing_primitive",
- "generalized_drawing_primitive3",
- "generalized_structure_element",
- "get_choice",
- "get_item_type_from_metafile",
- "get_locator",
- "get_locator3",
- "get_pick",
- "get_string",
- "get_stroke",
- "get_stroke3",
- "get_valuator",
- "incremental_spatial_search",
- "incremental_spatial_search3",
- "initialize_choice",
- "initialize_choice3",
- "initialize_locator",
- "initialize_locator3",
- "initialize_pick",
- "initialize_pick3",
- "initialize_string",
- "initialize_string3",
- "initialize_stroke",
- "initialize_stroke3",
- "initialize_valuator",
- "initialize_valuator3",
- "inquire_all_conflicting_structures",
- "inquire_annotation_facilities",
- "inquire_archive_files",
- "inquire_archive_state_value",
- "inquire_choice_device_state",
- "inquire_choice_device_state3",
- "inquire_colour_facilities",
- "inquire_colour_model",
- "inquire_colour_model_facilities",
- "inquire_colour_representation",
- "inquire_conflict_resolution",
- "inquire_conflicting_structures_in_network",
- "inquire_current_element_content",
- "inquire_current_element_type_and_size",
- "inquire_default_choice_device_data",
- "inquire_default_choice_device_data3",
- "inquire_default_display_update_state",
- "inquire_default_locator_device_data",
- "inquire_default_locator_device_data3",
- "inquire_default_pick_device_data",
- "inquire_default_pick_device_data3",
- "inquire_default_string_device_data",
- "inquire_default_string_device_data3",
- "inquire_default_stroke_device_data",
- "inquire_default_stroke_device_data3",
- "inquire_default_valuator_device_data",
- "inquire_default_valuator_device_data3",
- "inquire_display_space_size",
- "inquire_display_space_size3",
- "inquire_display_update_state",
- "inquire_dynamics_of_structures",
- "inquire_dynamics_of_workstation_attributes",
- "inquire_edge_facilities",
- "inquire_edge_representation",
- "inquire_edit_mode",
- "inquire_element_content",
- "inquire_element_pointer",
- "inquire_element_type_and_size",
- "inquire_error_handling_mode",
- "inquire_generalized_drawing_primitive",
- "inquire_generalized_drawing_primitive3",
- "inquire_generalized_structure_element_facilities",
- "inquire_highlighting_filter",
- "inquire_hlhsr_facilities",
- "inquire_hlhsr_mode",
- "inquire_input_queue_overflow",
- "inquire_interior_facilities",
- "inquire_interior_representation",
- "inquire_invisibility_filter",
- "inquire_list_of_available_generalized_drawing_primitives",
- "inquire_list_of_available_generalized_drawing_primitives3",
- "inquire_list_of_available_generalized_structure_elements",
- "inquire_list_of_available_workstation_types",
- "inquire_list_of_colour_indices",
- "inquire_list_of_edge_indices",
- "inquire_list_of_interior_indices",
- "inquire_list_of_pattern_indices",
- "inquire_list_of_polyline_indices",
- "inquire_list_of_polymarker_indices",
- "inquire_list_of_text_indices",
- "inquire_list_of_view_indices",
- "inquire_locator_device_state",
- "inquire_locator_device_state3",
- "inquire_modelling_clipping_facilities",
- "inquire_more_simultaneous_events",
- "inquire_number_of_available_logical_input_devices",
- "inquire_number_of_display_priorities_supported",
- "inquire_open_structure",
- "inquire_paths_to_ancestors",
- "inquire_paths_to_descendants",
- "inquire_pattern_facilities",
- "inquire_pattern_representation",
- "inquire_phigs_facilities",
- "inquire_pick_device_state",
- "inquire_pick_device_state3",
- "inquire_polyline_facilities",
- "inquire_polyline_representation",
- "inquire_polymarker_facilities",
- "inquire_polymarker_representation",
- "inquire_posted_structures",
- "inquire_predefined_colour_representation",
- "inquire_predefined_edge_representation",
- "inquire_predefined_interior_representation",
- "inquire_predefined_pattern_representation",
- "inquire_predefined_polyline_representation",
- "inquire_predefined_polymarker_representation",
- "inquire_predefined_text_representation",
- "inquire_predefined_view_representation",
- "inquire_set_of_open_workstations",
- "inquire_set_of_workstations_to_which_posted",
- "inquire_string_device_state",
- "inquire_string_device_state3",
- "inquire_stroke_device_state",
- "inquire_stroke_device_state3",
- "inquire_structure_identifiers",
- "inquire_structure_state_value",
- "inquire_structure_status",
- "inquire_system_state_value",
- "inquire_text_extent",
- "inquire_text_facilities",
- "inquire_text_representation",
- "inquire_valuator_device_state",
- "inquire_valuator_device_state3",
- "inquire_view_facilities",
- "inquire_view_representation",
- "inquire_workstation_category",
- "inquire_workstation_classification",
- "inquire_workstation_connection_and_type",
- "inquire_workstation_state_value",
- "inquire_workstation_state_table_lengths",
- "inquire_workstation_transformation",
- "inquire_workstation_transformation3",
- "interpret_item",
- "label",
- "message",
- "offset_element_pointer",
- "open_archive_file",
- "open_phigs",
- "open_structure",
- "open_workstation",
- "polyline",
- "polyline3",
- "polymarker",
- "polymarker3",
- "post_structure",
- "read_item_from_metafile",
- "redraw_all_structures",
- "remove_names_from_set",
- "request_choice",
- "request_locator",
- "request_locator3",
- "request_pick",
- "request_string",
- "request_stroke",
- "request_stroke3",
- "request_valuator",
- "restore_modelling_clipping_volume",
- "retrieve_all_structures",
- "retrieve_paths_to_ancestors",
- "retrieve_paths_to_descendants",
- "retrieve_structure_identifiers",
- "retrieve_structures",
- "retrieve_structure_networks",
- "rotate",
- "rotate_x",
- "rotate_y",
- "rotate_z",
- "sample_choice",
- "sample_locator",
- "sample_locator3",
- "sample_pick",
- "sample_string",
- "sample_stroke",
- "sample_stroke3",
- "sample_valuator",
- "scale",
- "scale3",
- #ifdef SUN
- "set_edge_colour",
- "set_interior_colour",
- "set_polyline_colour",
- "set_polymarker_colour",
- "set_text_colour",
- #endif
- "set_annotation_style",
- "set_annotation_text_alignment",
- "set_annotation_text_character_height",
- "set_annotation_text_character_up_vector",
- "set_annotation_text_path",
- "set_character_expansion_factor",
- "set_character_height",
- "set_character_spacing",
- "set_character_up_vector",
- "set_choice_mode",
- "set_colour_model",
- "set_colour_representation",
- "set_conflict_resolution",
- "set_display_update_state",
- "set_edge_colour_index",
- "set_edge_flag",
- "set_edge_index",
- "set_edge_representation",
- "set_edgetype",
- "set_edgewidth_scale_factor",
- "set_edit_mode",
- "set_element_pointer",
- "set_element_pointer_at_label",
- "set_error_handling_mode",
- "set_global_transformation",
- "set_global_transformation3",
- "set_highlighting_filter",
- "set_hlhsr_identifier",
- "set_hlhsr_mode",
- "set_individual_asf",
- "set_interior_colour_index",
- "set_interior_index",
- "set_interior_representation",
- "set_interior_style",
- "set_interior_style_index",
- "set_invisibility_filter",
- "set_linetype",
- "set_linewidth_scale_factor",
- "set_local_transformation",
- "set_local_transformation3",
- "set_locator_mode",
- "set_marker_size_scale_factor",
- "set_marker_type",
- "set_modelling_clipping_indicator",
- "set_modelling_clipping_volume",
- "set_modelling_clipping_volume3",
- "set_pattern_reference_point",
- "set_pattern_reference_point_and_vectors",
- "set_pattern_representation",
- "set_pattern_size",
- "set_pick_filter",
- "set_pick_identifier",
- "set_pick_mode",
- "set_polyline_colour_index",
- "set_polyline_index",
- "set_polyline_representation",
- "set_polymarker_colour_index",
- "set_polymarker_index",
- "set_polymarker_representation",
- "set_string_mode",
- "set_stroke_mode",
- "set_text_alignment",
- "set_text_colour_index",
- "set_text_font",
- "set_text_index",
- "set_text_path",
- "set_text_precision",
- "set_text_representation",
- "set_valuator_mode",
- "set_view_index",
- "set_view_representation",
- "set_view_representation3",
- "set_view_transformation_input_priority",
- "set_workstation_viewport",
- "set_workstation_viewport3",
- "set_workstation_window",
- "set_workstation_window3",
- "text",
- "text3",
- "transform_point",
- "transform_point3",
- "translate",
- "translate3",
- "unpost_all_structures",
- "unpost_structure",
- "update_workstation",
- "write_item_to_metafile",
- #ifdef SUN
- "cell_array3_plus",
- "compute_fill_area_set_geometric_normal",
- "fill_area_set_with_data",
- "fill_area_set3_with_data",
- "inquire_colour_mapping_facilities",
- "inquire_colour_mapping_method_facilities",
- "inquire_colour_mapping_representation",
- "inquire_colour_mapping_state",
- "inquire_curve_and_surface_facilities",
- "inquire_data_mapping_facilities",
- "inquire_data_mapping_representation",
- "inquire_depth_cue_facilities",
- "inquire_depth_cue_representation",
- "inquire_direct_colour_model_facilities",
- "inquire_dynamics_of_workstation_attributes_plus",
- "inquire_edge_representation_plus",
- "inquire_interior_facilities_plus",
- "inquire_interior_representation_plus",
- "inquire_light_source_facilities",
- "inquire_light_source_representation",
- "inquire_list_of_colour_mapping_indices",
- "inquire_list_of_data_mapping_indices",
- "inquire_list_of_depth_cue_indices",
- "inquire_list_of_light_source_indices",
- "inquire_list_of_parametric_surface_indices",
- "inquire_list_of_reflectance_indices",
- "inquire_parametric_surface_representation",
- "inquire_pattern_representation_plus",
- "inquire_polyline_facilities_plus",
- "inquire_polyline_representation_plus",
- "inquire_polymarker_representation_plus",
- "inquire_predefined_colour_mapping_representation",
- "inquire_predefined_data_mapping_representation",
- "inquire_predefined_depth_cue_representation",
- "inquire_predefined_edge_representation_plus",
- "inquire_predefined_interior_representation_plus",
- "inquire_predefined_light_source_representation",
- "inquire_predefined_parametric_surface_representation",
- "inquire_predefined_pattern_representation_plus",
- "inquire_predefined_polyline_representation_plus",
- "inquire_predefined_polymarker_representation_plus",
- "inquire_predefined_reflectance_representation",
- "inquire_predefined_text_representation_plus",
- "inquire_reflectance_facilities",
- "inquire_reflectance_representation",
- "inquire_rendering_colour_model_facilities",
- "inquire_text_representation_plus",
- "inquire_workstation_state_table_lengths_plus",
- "non-uniform_b-spline_curve",
- "non-uniform_b-spline_curve_with_colour",
- "non-uniform_b-spline_surface",
- "non-uniform_b-spline_surface_with_data",
- "polyline_set3_with_data",
- "quadrilateral_mesh_with_data",
- "quadrilateral_mesh3_with_data",
- "set_back_data_mapping_index",
- "set_back_data_mapping_method",
- "set_back_interior_colour",
- "set_back_interior_index",
- "set_back_interior_shade_method",
- "set_back_interior_style",
- "set_back_interior_style_index",
- "set_back_reflectance_index",
- "set_back_reflectance_model",
- "set_back_reflectance_properties",
- "set_colour_mapping_index",
- "set_colour_mapping_representation",
- "set_curve_approximation_criteria",
- "set_data_mapping_index",
- "set_data_mapping_method",
- "set_data_mapping_representation",
- "set_depth_cue_index",
- "set_depth_cue_representation",
- "set_edge_representation_plus",
- "set_face_culling_mode",
- "set_face_distinguishing_mode",
- "set_interior_representation_plus",
- "set_interior_shading_method",
- "set_light_source_representation",
- "set_light_source_state",
- "set_of_fill_area_set_with_data",
- "set_of_fill_area_set3_with_data",
- "set_parametric_surface_characteristics",
- "set_parametric_surface_index",
- "set_parametric_surface_representation",
- "set_pattern_representation_plus",
- "set_polyline_representation_plus",
- "set_polyline_shading_method",
- "set_polymarker_representation_plus",
- "set_reflectance_index",
- "set_reflectance_model",
- "set_reflectance_properties",
- "set_reflectance_representation",
- "set_rendering_colour_model",
- "set_surface_approximation_criteria",
- "set_text_representation_plus",
- "triangle_set_with_data",
- "triangle_set3_with_data",
- "triangle_strip_with_data",
- "triangle_strip3_with_data",
- #endif
- };
-
- #include "enumname.c"
-
- /* local variables for phinter: */
- static FILE *outputscript; /* output script file var */
- static FILE *inputscript;
- static FILE *informscript;
- static Pint outputterm;
- static Pint informterm;
- static ptkboolean writingscript; /* if TRUE, all input commands are echoed */
- static ptkboolean interactive;
- static ptkboolean writeinform;
- static ptkboolean phinteron;
- static jmp_buf EXITJMP;
- static jmp_buf POPJMP;
- static jmp_buf PFABORT;
- static Pint lno; /* current line number */
- static Pint activefunction;
- static ptkboolean fileswitch;
- static Plimit phinecho;
- static Pint phinws;
- /* registers */
- static Pmatrix3 vmm3, vom3, tm3;
- static Pmatrix vmm, vom, tm;
- static Pint wst;
- static Pstore wststore;
- static colourmodel = 1;
-
- /*--------------------------------------------------------------------------*/
- /*------------------------ Internal functions ------------------------------*/
- /*--------------------------------------------------------------------------*/
-
- static void getcolourmodel(C(Pint) wsid)
- PreANSI(Pint wsid)
- {
- Pint err;
-
- pinq_colr_model(wsid, &err, &colourmodel);
- if (err != 0)
- colourmodel = 1;
- } /* getcolourmodel */
-
- /*--------------------------------------------------------------------------*/
-
- static void printfterminal(C(Pint) windid, C(char *) format, ap)
- PreANSI(Pint windid)
- PreANSI(char *format)
- va_list *ap;
- /*
- ** \parambegin
- ** \param{Pint}{windid}{terminal window identifier}{IN}
- ** \param{char *}{format}{format string}{IN}
- ** \param{}{va\_alist}{variable length argument list}{IN}
- ** \paramend
- ** \blurb{Does the same as writeterminal except any following
- ** strings will be displayed on a new line.}
- */
- {
- char str[255], line[255];
- char *newline, *firstchar;
-
- vsprintf(str, format, *ap);
- firstchar = &str[0];
- while ((newline = strchr(firstchar, '\n')) != NULL)
- {
- strncpy(line, firstchar, (newline - firstchar));
- line[newline - firstchar] = '\0';
- ptk_writelnterminal(windid, line);
- firstchar = newline + 1;
- }
-
- if (firstchar != '\0')
- ptk_writeterminal(windid, firstchar);
- } /* printfterminal */
-
- /*--------------------------------------------------------------------------*/
-
- static void phinprintf(C(ptkedest) dest, C(char *) format, va_alist)
- PreANSI(ptkedest dest)
- PreANSI(char *format)
- va_dcl
- /*
- */
- {
- va_list args;
- char str[255], line[255];
- char *newline, *firstchar;
-
- va_start(args);
- if (fileswitch)
- {
- switch (dest)
- {
- case PTKEOUTPUT: vfprintf(outputscript, format, args);
- break;
-
- case PTKEINFORM: vfprintf(informscript, format, args);
- break;
-
- case PTKESTDOUT: vfprintf(stdout, format, args);
- break;
- }
- }
- else
- {
- switch (dest)
- {
- case PTKEOUTPUT: printfterminal(outputterm, format, &args);
- break;
-
- case PTKESTDOUT:
- if (writeinform)
- printfterminal(informterm, format, &args);
- break;
-
- case PTKEINFORM: printfterminal(informterm, format, &args);
- break;
- }
- }
- va_end(args);
- } /* phinprintf */
-
- /*--------------------------------------------------------------------------*/
-
- static void phigserror(C(ptkedest) dest, C(Pint) error)
- PreANSI(ptkedest dest)
- PreANSI(Pint error)
- {
- phinprintf(dest, "error with %s = %d.\n", phigsnamelist[activefunction],
- error);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void phintererror(C(Pint) c, C(char *) s, C(ptkeseverity) severity)
- PreANSI(Pint c)
- PreANSI(char *s)
- PreANSI(ptkeseverity severity)
- /*
- ** description: writes out a message, and exits if severity=EXITERR.
- ** input params:
- ** output params:
- ** return value:
- */
- {
- switch (c)
- {
- #ifdef SUN
- case 1: fprintf(stderr, "Phinter: function not yet supported in SunPHIGS.\n");
- break;
- #endif
- #ifdef VMS
- case 1: fprintf(stderr, "Phinter: function not yet supported in DEC PHIGS.\n");
- break;
- #endif
- #ifdef HP
- case 1: fprintf(stderr, "function not yet supported in HP PHIGS.\n");
- break;
- #endif
- #ifdef PEXSI
- case 1: fprintf(stderr, "function not yet supported in PEX-SI PHIGS.\n");
- break;
- #endif
- case 2: fprintf(stderr, "%s", s);
- break;
-
- case 3: fprintf(stderr, "function not yet supported in phinter.\n");
- break;
- }
- if (severity == POPREQ)
- {
- longjmp(POPJMP, 1);
- return;
- }
- if (severity == EXITERR)
- longjmp(EXITJMP, 1);
- } /* phintererror */
-
- /*--------------------------------------------------------------------------*/
-
- static void set_i_prompt(C(char *) s)
- PreANSI(char *s)
- /*
- ** description: only set prompt for an interactive device.
- ** input params: s - prompt.
- ** output params: none.
- ** return value: none.
- */
- {
- if (interactive)
- printf("%s> ", s);
- } /* set_i_prompt */
-
- /*--------------------------------------------------------------------------*/
- /*-------------------- general writing functions ---------------------------*/
- /*--------------------------------------------------------------------------*/
-
- static void writephigsenum(C(ptkedest) dest, C(ptkephigsenum) enumtype,
- C(Pint) enumval)
- PreANSI(ptkedest dest)
- PreANSI(ptkephigsenum enumtype)
- PreANSI(Pint enumval)
- {
- switch (enumtype)
- {
- case PTKEWSDEP:
- phinprintf(dest, "%s\n", Pws_dep_indnames[enumval]);
- break;
-
- case PTKESYSTEMSTATE:
- phinprintf(dest, "%s\n", Psys_stnames[enumval]);
- break;
-
- case PTKEWSSTATE:
- phinprintf(dest, "%s\n", Pws_stnames[enumval]);
- break;
-
- case PTKESTRUCTSTATE:
- phinprintf(dest, "%s\n", Pstruct_stnames[enumval]);
- break;
-
- case PTKESTRUCTSTATUS:
- phinprintf(dest, "%s\n", Pstruct_statusnames[enumval]);
- break;
-
- case PTKEARCHIVESTATE:
- phinprintf(dest, "%s\n", Par_stnames[enumval]);
- break;
-
- case PTKEWSCLASS:
- phinprintf(dest, "%s\n", Pws_classnames[enumval]);
- break;
-
- case PTKEWSCAT:
- phinprintf(dest, "%s\n", Pws_catnames[enumval]);
- break;
-
- case PTKECONTROL:
- phinprintf(dest, "%s\n", Pctrl_flagnames[enumval]);
- break;
-
- case PTKEREGEN:
- phinprintf(dest, "%s\n", Pregen_flagnames[enumval]);
- break;
-
- case PTKEDEFMODE:
- phinprintf(dest, "%s\n", Pdefer_modenames[enumval]);
- break;
-
- case PTKEMOD:
- phinprintf(dest, "%s\n", Pmodnames[enumval]);
- break;
-
- case PTKESIMULTEV:
- phinprintf(dest, "%s\n", Psimult_eventsnames[enumval]);
- break;
-
- case PTKESTRUCTNETSRC:
- phinprintf(dest, "%s\n", Pstruct_net_sourcenames[enumval]);
- break;
-
- case PTKEDSPSURF:
- phinprintf(dest, "%s\n", Pdisp_surfnames[enumval]);
- break;
-
- case PTKEVISUALREP:
- phinprintf(dest, "%s\n", Pvisual_stnames[enumval]);
- break;
-
- case PTKETXPREC:
- phinprintf(dest, "%s\n", Ptext_precnames[enumval]);
- break;
-
- case PTKETXPATH:
- phinprintf(dest, "%s\n", Ptext_pathnames[enumval]);
- break;
-
- case PTKETXHOR:
- phinprintf(dest, "%s\n", Phor_alignnames[enumval]);
- break;
-
- case PTKETXVER:
- phinprintf(dest, "%s\n", Pvert_alignnames[enumval]);
- break;
-
- case PTKEINTERSTYLE:
- phinprintf(dest, "%s\n", Pint_stylenames[enumval]);
- break;
-
- case PTKEEDGEF:
- phinprintf(dest, "%s\n", Pedge_flagnames[enumval]);
- break;
-
- case PTKEATTRID:
- phinprintf(dest, "%s\n", Paspectnames[enumval]);
- break;
-
- case PTKEASF:
- phinprintf(dest, "%s\n", Pasfnames[enumval]);
- break;
-
- case PTKECOAVAIL:
- phinprintf(dest, "%s\n", Pcolr_availnames[enumval]);
- break;
-
- case PTKECOMPTYPE:
- phinprintf(dest, "%s\n", Pcompose_typenames[enumval]);
- break;
-
- case PTKEPROJTYPE:
- phinprintf(dest, "%s\n", Pproj_typenames[enumval]);
- break;
-
- case PTKECLIP:
- phinprintf(dest, "%s\n", Pclip_indnames[enumval]);
- break;
-
- case PTKEVPRI:
- phinprintf(dest, "%s\n", Pprinames[enumval]);
- break;
-
- case PTKECONFRES:
- phinprintf(dest, "%s\n", Pconf_resnames[enumval]);
- break;
-
- case PTKEPFCF:
- phinprintf(dest, "%s\n", Ppfcfnames[enumval]);
- break;
-
- case PTKEPATHORDER:
- phinprintf(dest, "%s\n", Ppath_ordernames[enumval]);
- break;
-
- case PTKEIMODE:
- phinprintf(dest, "%s\n", Pop_modenames[enumval]);
- break;
-
- case PTKEESW:
- phinprintf(dest, "%s\n", Pechonames[enumval]);
- break;
-
- case PTKEISTATUS:
- phinprintf(dest, "%s\n", Pistatusnames[enumval]);
- break;
-
- case PTKEOPENSTRUCTSTATUS:
- phinprintf(dest, "%s\n", Popen_struct_statusnames[enumval]);
- break;
-
- case PTKEICLASS:
- phinprintf(dest, "%s\n", Pin_classnames[enumval]);
- break;
-
- case PTKEPRF:
- phinprintf(dest, "%s\n", Pprompt_switchnames[enumval]);
- break;
-
- case PTKEINQTYPE:
- phinprintf(dest, "%s\n", Pinq_typenames[enumval]);
- break;
-
- case PTKEUPDATEST:
- phinprintf(dest, "%s\n", Pupd_stnames[enumval]);
- break;
-
- case PTKEDEVUNITS:
- phinprintf(dest, "%s\n", Pdc_unitsnames[enumval]);
- break;
-
- case PTKEMODTYPE:
- phinprintf(dest, "%s\n", Pdyn_modnames[enumval]);
- break;
-
- case PTKEATTRS:
- phinprintf(dest, "%s\n", Pattrsnames[enumval]);
- break;
-
- case PTKEELTYPE:
- phinprintf(dest, "%s\n", Pelem_typenames[enumval]);
- break;
-
- case PTKEEDITMODE:
- phinprintf(dest, "%s\n", Pedit_modenames[enumval]);
- break;
-
- case PTKEREFF:
- phinprintf(dest, "%s\n", Pref_flagnames[enumval]);
- break;
-
- case PTKEERRORMODE:
- phinprintf(dest, "%s\n", Perr_modenames[enumval]);
- break;
-
- case PTKESRCHDIR:
- phinprintf(dest, "%s\n", Psearch_dirnames[enumval]);
- break;
-
- case PTKESRCHSTATUS:
- phinprintf(dest, "%s\n", Psearch_statusnames[enumval]);
- break;
-
- case PTKESRCHELTYPE:
- phinprintf(dest, "%s\n", Pelem_typenames[enumval]);
- break;
-
- #ifdef SUN
- case PTKEBASENAME:
- phinprintf(dest, "%s\n", Pbasenames[enumval]);
- break;
-
- case PTKEWSTYPEATTR:
- phinprintf(dest, "%s\n", Pwsattrnames[enumval]);
- break;
-
- case PTKEDBLBUFF:
- phinprintf(dest, "%s\n", Pdblbuffnames[enumval]);
- break;
-
- case PTKEACCUSAGE:
- phinprintf(dest, "%s\n", Paccusagenames[enumval]);
- break;
-
- case PTKECURSORTYPE:
- phinprintf(dest, "%s\n", Pcursortypenames[enumval]);
- break;
-
- case PTKECOLOURMODE:
- phinprintf(dest, "%s\n", Pcolourmodenames[enumval]);
- break;
-
- case PTKECGMENCODING:
- phinprintf(dest, "%s\n", Pcgmencodingnames[enumval]);
- break;
-
- case PTKECGMCONFORMANCE:
- phinprintf(dest, "%s\n", Pcgmconformancenames[enumval]);
- break;
-
- case PTKECGMVDCPRECISION:
- phinprintf(dest, "%s\n", Pcgmvdcprecisionnames[enumval]);
- break;
-
- case PTKEBGCLEAR:
- phinprintf(dest, "%s\n", Pbgclearnames[enumval]);
- break;
-
- case PTKEUSEDECOMP:
- phinprintf(dest, "%s\n", Pdcmpnames[enumval]);
- break;
-
- case PTKEDCMODEL:
- phinprintf(dest, "%s\n", Pdcmodelnames[enumval]);
- break;
-
- case PTKESIMULATEPICK:
- phinprintf(dest, "%s\n", Psimulatepicknames[enumval]);
- break;
- #endif
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- case PTKEDCUEMODE:
- phinprintf(dest, "%s\n", Pdcuemodenames[enumval]);
- break;
-
- case PTKERATIONAL:
- phinprintf(dest, "%s\n", Prationalnames[enumval]);
- break;
-
- case PTKECULLMODE:
- phinprintf(dest, "%s\n", Pcullmodenames[enumval]);
- break;
-
- case PTKEDISTINGMODE:
- phinprintf(dest, "%s\n", Pdistingmodenames[enumval]);
- break;
-
- case PTKECURVEPLACE:
- phinprintf(dest, "%s\n", Pcurveplacenames[enumval]);
- break;
- #endif
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeenumlist(C(ptkedest) dest, C(ptkephigsenum) enumtype,
- C(Pint) length, C(Pint *) enumlist)
- PreANSI(ptkedest dest)
- PreANSI(ptkephigsenum enumtype)
- PreANSI(Pint length)
- PreANSI(Pint *enumlist)
- {
- Pint i;
-
- for (i = 0; i < length; i++)
- writephigsenum(dest, enumtype, enumlist[i]);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeinteger(C(ptkedest) dest, C(Pint) value)
- PreANSI(ptkedest dest)
- PreANSI(Pint value)
- {
- phinprintf(dest, "%d\n", value);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeintvalue(C(ptkedest) dest, C(Pint) value,
- C(ptkehashtable) htable)
- PreANSI(ptkedest dest)
- PreANSI(Pint value)
- PreANSI(ptkehashtable htable)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- char tablename[20], str[100];
- Pint size;
-
- switch (htable)
- {
- case PTKESTRUCTID:
- strcpy(tablename, "structureid");
- break;
-
- case PTKELABELVAL:
- strcpy(tablename, "label");
- break;
-
- case PTKEPICKID:
- strcpy(tablename, "pickid");
- break;
-
- case PTKEVIEWIND:
- strcpy(tablename, "viewindex");
- break;
-
- case PTKECOLOURIND:
- strcpy(tablename, "colourindex");
- break;
-
- case PTKENAME:
- strcpy(tablename, "name");
- break;
- }
- if (ptk_hashtableused(tablename))
- {
- ptk_inttostring(tablename, value, 100, str, &size);
- if (size > 0)
- phinprintf(dest,"\"%s\"\n", str);
- else
- writeinteger(dest, value);
- }
- else
- {
- writeinteger(dest, value);
- }
- } /* writeintvalue */
-
- /*--------------------------------------------------------------------------*/
-
- static void writereal(C(ptkedest) dest, C(Pfloat) value)
- PreANSI(ptkedest dest)
- PreANSI(Pfloat value)
- {
- phinprintf(dest, "%f\n", value);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepoint(C(ptkedest) dest, C(Ppoint *) pt)
- PreANSI(ptkedest dest)
- PreANSI(Ppoint *pt)
- {
- phinprintf(dest, "%f %f\n", pt->x, pt->y);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writevector(C(ptkedest) dest, C(Pvec *) vec)
- PreANSI(ptkedest dest)
- PreANSI(Pvec *vec)
- {
- phinprintf(dest, "%f %f\n", vec->delta_x, vec->delta_y);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writefloatsize(C(ptkedest) dest, C(Pfloat_size *) fs)
- PreANSI(ptkedest dest)
- PreANSI(Pfloat_size *fs)
- {
- phinprintf(dest, "%f %f\n", fs->size_x, fs->size_y);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeintsize(C(ptkedest) dest, C(Pint_size *) is)
- PreANSI(ptkedest dest)
- PreANSI(Pint_size *is)
- {
- phinprintf(dest, "%d %d\n", is->size_x, is->size_y);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepoint3(C(ptkedest) dest, C(Ppoint3 *) pt)
- PreANSI(ptkedest dest)
- PreANSI(Ppoint3 *pt)
- {
- phinprintf(dest, "%f %f %f\n", pt->x, pt->y, pt->z);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writevector3(C(ptkedest) dest, C(Pvec3 *) vec)
- PreANSI(ptkedest dest)
- PreANSI(Pvec3 *vec)
- {
- phinprintf(dest, "%f %f %f\n", vec->delta_x, vec->delta_y, vec->delta_z);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writefloatsize3(C(ptkedest) dest, C(Pfloat_size3 *) sz)
- PreANSI(ptkedest dest)
- PreANSI(Pfloat_size3 *sz)
- {
- phinprintf(dest, "%f %f %f\n", sz->size_x, sz->size_y, sz->size_z);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeintsize3(C(ptkedest) dest, C(Pint_size3 *) sz)
- PreANSI(ptkedest dest)
- PreANSI(Pint_size3 *sz)
- {
- phinprintf(dest, "%d %d %d\n", sz->size_x, sz->size_y, sz->size_z);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writecobundl(C(ptkedest) dest, C(Pcolr_rep *) colour)
- PreANSI(ptkedest dest)
- PreANSI(Pcolr_rep *colour)
- {
- switch (colourmodel)
- {
- case PMODEL_RGB:
- phinprintf(dest, "%f %f %f\n", colour->rgb.red, colour->rgb.green,
- colour->rgb.blue);
- break;
-
- case PMODEL_CIELUV:
- phinprintf(dest, "%f %f %f\n", colour->cieluv.cieluv_x,
- colour->cieluv.cieluv_y, colour->cieluv.cieluv_y_lum);
- break;
-
- case PMODEL_HSV:
- phinprintf(dest, "%f %f %f\n", colour->hsv.hue,
- colour->hsv.satur, colour->hsv.value);
- break;
-
- case PMODEL_HLS:
- phinprintf(dest, "%f %f %f\n", colour->hls.hue,
- colour->hls.lightness, colour->hls.satur);
- break;
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- static void writecolreplist(C(ptkedest) dest, C(Pcolr_rep_list *) colours)
- PreANSI(ptkedest dest)
- PreANSI(Pcolr_rep_list *colours)
- {
- Pint i;
-
- writeinteger(dest, colours->num_colr_reps);
- for (i = 0; i < colours->num_colr_reps; i++)
- writecobundl(dest, &colours->colr_reps[i]);
- }
- #endif
-
- /*--------------------------------------------------------------------------*/
-
- static void writelimit(C(ptkedest) dest, C(Plimit *) lt)
- PreANSI(ptkedest dest)
- PreANSI(Plimit *lt)
- {
- phinprintf(dest, "%f %f\n", lt->x_min, lt->x_max);
- phinprintf(dest, "%f %f\n", lt->y_min, lt->y_max);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writelimit3(C(ptkedest) dest, C(Plimit3 *) lt)
- PreANSI(ptkedest dest)
- PreANSI(Plimit3 *lt)
- {
- phinprintf(dest, "%f %f\n", lt->x_min, lt->x_max);
- phinprintf(dest, "%f %f\n", lt->y_min, lt->y_max);
- phinprintf(dest, "%f %f\n", lt->z_min, lt->z_max);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writematrix(C(ptkedest) dest, C(Pmatrix) mat)
- PreANSI(ptkedest dest)
- PreANSI(Pmatrix mat)
- {
- Pint i;
-
- for (i = 0; i < 3; i++)
- phinprintf(dest, "%f %f %f\n", mat[i][0], mat[i][1], mat[i][2]);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writematrix3(C(ptkedest) dest, C(Pmatrix3) mat)
- PreANSI(ptkedest dest)
- PreANSI(Pmatrix3 mat)
- {
- Pint i;
-
- for (i = 0; i <= 3; i++)
- phinprintf(dest, "%f %f %f %f\n", mat[i][0], mat[i][1], mat[i][2],
- mat[i][3]);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeintlst(C(ptkedest) dest, C(Pint_list *) intlist,
- C(ptkehashtable) htable)
- PreANSI(ptkedest dest)
- PreANSI(Pint_list *intlist)
- PreANSI(ptkehashtable htable)
- {
- Pint i;
-
- writeinteger(dest, intlist->num_ints);
- for (i = 0; i < intlist->num_ints; i++)
- {
- writeintvalue(dest, intlist->ints[i], htable);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writefloatlist(C(ptkedest) dest, C(Pfloat_list *) flist)
- PreANSI(ptkedest dest)
- PreANSI(Pfloat_list *flist)
- {
- Pint i;
-
- writeinteger(dest, flist->num_floats);
- for (i = 0; i < flist->num_floats; i++)
- {
- writereal(dest, flist->floats[i]);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointlst3(C(ptkedest) dest, C(Ppoint_list3 *) ptlist)
- PreANSI(ptkedest dest)
- PreANSI(Ppoint_list3 *ptlist)
- {
- Pint i;
-
- writeinteger(dest, ptlist->num_points);
- for (i = 0; i < ptlist->num_points; i++)
- {
- writepoint3(dest, &ptlist->points[i]);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointlst(C(ptkedest) dest, C(Ppoint_list *) ptlist)
- PreANSI(ptkedest dest)
- PreANSI(Ppoint_list *ptlist)
- {
- Pint i;
-
- writeinteger(dest, ptlist->num_points);
- for (i = 0; i < ptlist->num_points; i++)
- {
- writepoint(dest, &ptlist->points[i]);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeintarray(C(ptkedest) dest, C(Pint) num, C(Pint *) ints,
- C(ptkehashtable) htable)
- PreANSI(ptkedest dest)
- PreANSI(Pint num)
- PreANSI(Pint *ints)
- PreANSI(ptkehashtable htable)
- {
- Pint i;
-
- for (i = 0; i < num; i++)
- {
- writeintvalue(dest, ints[i], htable);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointarray(C(ptkedest) dest, C(Pint) numpts,
- C(Ppoint *) pts)
- PreANSI(ptkedest dest)
- PreANSI(Pint numpts)
- PreANSI(Ppoint *pts)
- {
- Pint i;
-
- for (i = 0; i < numpts; i++)
- {
- writepoint(dest, &pts[i]);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointarray3(C(ptkedest) dest, C(Pint) numpts,
- C(Ppoint3 *) pts)
- PreANSI(ptkedest dest)
- PreANSI(Pint numpts)
- PreANSI(Ppoint3 *pts)
- {
- Pint i;
-
- for (i = 0; i < numpts; i++)
- {
- writepoint3(dest, &pts[i]);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writepickpath(C(ptkedest) dest, C(Ppick_path *) path)
- PreANSI(ptkedest dest)
- PreANSI(Ppick_path *path)
- {
- Pint i;
-
- phinprintf(dest, "depth = %d\n", path->depth);
- for (i = 0; i < path->depth; i++)
- {
- phinprintf(dest, "structure identifier [%d] = %d\n", i,
- path->path_list[i].struct_id);
- phinprintf(dest, "pick identifier [%d] = %d\n", i,
- path->path_list[i].pick_id);
- phinprintf(dest, "element [%d] = %d\n", i,
- path->path_list[i].elem_pos);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- /*--------------------------------------------------------------------------*/
- /*------------------- PHIGS PLUS write functions ---------------------------*/
- /*--------------------------------------------------------------------------*/
-
- #ifdef SUN
-
- static void writeintlistlist(C(ptkedest) dest, C(Pint_list_list *) lists,
- C(ptkehashtable) htable)
- PreANSI(ptkedest dest)
- PreANSI(Pint_list_list *lists)
- PreANSI(ptkehashtable htable)
- {
- Pint i;
-
- writeinteger(dest, lists->num_lists);
- for (i = 0; i < lists->num_lists; i++)
- {
- writeintlst(dest, lists->lists[i], htable);
- }
- } /* writeintlistlist */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepoint4(C(ptkedest) dest, C(Ppoint4 *) pt)
- PreANSI(ptkedest dest)
- PreANSI(Ppoint4 *pt)
- {
- phinprintf(dest, "%f %f %f %f\n", pt->x, pt->y, pt->z, pt->w);
- } /* writepoint4 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writegcolr(C(ptkedest) dest, C(Pgcolr *) colour)
- PreANSI(ptkedest dest)
- PreANSI(Pgcolr *colour)
- {
- writeinteger(dest, colour->type);
- if (colour->type == PINDIRECT)
- writeintvalue(dest, colour->val.ind, PTKECOLOURIND);
- else
- phinprintf(dest, "%f %f %f\n", colour->val.general.x,
- colour->val.general.y, colour->val.general.z);
- } /* writegcolr */
-
- /*--------------------------------------------------------------------------*/
-
- static void writedirectcolour(C(ptkedest) dest, C(Pint) colourmod,
- C(Pcolr_rep *) colour)
- PreANSI(ptkedest dest)
- PreANSI(Pint colourmod)
- PreANSI(Pcolr_rep *colour)
- {
- switch (colourmod)
- {
- case PMODEL_RGB:
- phinprintf(dest, "%f %f %f\n", colour->rgb.red, colour->rgb.green,
- colour->rgb.blue);
- break;
-
- case PMODEL_CIELUV:
- phinprintf(dest, "%f %f %f\n", colour->cieluv.cieluv_x,
- colour->cieluv.cieluv_y, colour->cieluv.cieluv_y_lum);
- break;
-
- case PMODEL_HSV:
- phinprintf(dest, "%f %f %f\n", colour->hsv.hue,
- colour->hsv.satur, colour->hsv.value);
- break;
-
- case PMODEL_HLS:
- phinprintf(dest, "%f %f %f\n", colour->hls.hue,
- colour->hls.lightness, colour->hls.satur);
- break;
- }
- } /* writedirectcolour */
-
- /*--------------------------------------------------------------------------*/
-
- static void writereflprops(C(ptkedest) dest, C(Prefl_props *) props)
- PreANSI(ptkedest dest)
- PreANSI(Prefl_props *props)
- {
- phinprintf(dest, "%f\n", props->ambient_coef);
- phinprintf(dest, "%f\n", props->diffuse_coef);
- phinprintf(dest, "%f\n", props->specular_coef);
- writegcolr(dest, &props->specular_colr);
- phinprintf(dest, "%f\n", props->specular_exp);
- phinprintf(dest, "%f\n", props->transpar_coef);
- } /* writereflprops */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeparal(C(ptkedest) dest, C(Pparal *) paral)
- PreANSI(ptkedest dest)
- PreANSI(Pparal *paral)
- {
- writepoint3(dest, ¶l->p);
- writepoint3(dest, ¶l->q);
- writepoint3(dest, ¶l->r);
- } /* writeparal */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeedgebundleplus(C(ptkedest) dest,
- C(Pedge_bundle_plus *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pedge_bundle_plus *bundl)
- {
- phinprintf(dest, "edge flag = ");
- writephigsenum(dest, PTKEEDGEF, bundl->flag);
- phinprintf(dest, "edge type = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "edgewidth scale factor = ");
- writereal(dest, bundl->width);
- phinprintf(dest, "edge colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->colr);
- } /* writedgebundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeinterbundleplus(C(ptkedest) dest,
- C(Pint_bundle_plus *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pint_bundle_plus *bundl)
- {
- phinprintf(dest, "interior style = ");
- writephigsenum(dest, PTKEINTERSTYLE, bundl->style);
- phinprintf(dest, "interior style index = ");
- writeinteger(dest, bundl->style_ind);
- phinprintf(dest, "interior colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->colr);
- phinprintf(dest, "reflectance model = %d\n", bundl->refl_eqn);
- phinprintf(dest, "shading method = %d\n", bundl->shad_meth);
- phinprintf(dest, "reflectance properties:\n");
- writereflprops(dest, &bundl->refl_props);
- phinprintf(dest, "back interior style = ");
- writephigsenum(dest, PTKEINTERSTYLE, bundl->back_style);
- phinprintf(dest, "back interior style index = ");
- writeinteger(dest, bundl->back_style_ind);
- phinprintf(dest, "back interior colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->back_colr);
- phinprintf(dest, "back reflectance model = %d\n",
- bundl->back_refl_eqn);
- phinprintf(dest, "back shading method = %d\n", bundl->back_shad_meth);
- phinprintf(dest, "back reflectance properties:\n");
- writereflprops(dest, &bundl->back_refl_props);
- phinprintf(dest, "approximation method = %d\n", bundl->approx_type);
- phinprintf(dest, "approximation value, U = %f\n", bundl->approx_val[0]);
- phinprintf(dest, "approximation value, V = %f\n", bundl->approx_val[1]);
- } /* writeinterbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void writelinebundleplus(C(ptkedest) dest,
- C(Pline_bundle_plus *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pline_bundle_plus *bundl)
- {
- phinprintf(dest, "linetype = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "linewidth scale factor = ");
- writereal(dest, bundl->width);
- phinprintf(dest, "line colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->colr);
- phinprintf(dest, "shading method = %d\n", bundl->shad_meth);
- phinprintf(dest, "curve approx type = %d\n", bundl->approx_type);
- phinprintf(dest, "curve approx value = %f\n", bundl->approx_val);
- } /* writelinebundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void writemarkerbundleplus(C(ptkedest) dest,
- C(Pmarker_bundle_plus *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pmarker_bundle_plus *bundl)
- {
- phinprintf(dest, "markertype = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "marker size scale factor = ");
- writereal(dest, bundl->size );
- phinprintf(dest, "marker colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->colr);
- } /* writemarkerbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void writetextbundleplus(C(ptkedest) dest,
- C(Ptext_bundle_plus *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Ptext_bundle_plus *bundl)
- {
- phinprintf(dest, "text font = ");
- writeinteger(dest, bundl->font);
- phinprintf(dest, "text precision = ");
- writephigsenum(dest, PTKETXPREC, bundl->prec);
- phinprintf(dest, "character expansion factor = ");
- writereal(dest, bundl->char_expan);
- phinprintf(dest, "character spacing = ");
- writereal(dest, bundl->char_space);
- phinprintf(dest, "text colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &bundl->colr);
- } /* writetextbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void writelightsrcbundle(C(ptkedest) dest,
- C(Plight_src_bundle *) light)
- PreANSI(ptkedest dest)
- PreANSI(Plight_src_bundle *light)
- {
- phinprintf(dest, "light source type = %d\n", light->type);
- switch (light->type)
- {
- case PLIGHT_AMBIENT:
- phinprintf(dest, "light source colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &light->rec.ambient.colr);
- break;
-
- case PLIGHT_DIRECTIONAL:
- phinprintf(dest, "light source colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &light->rec.directional.colr);
- phinprintf(dest, "light source direction:\n");
- writevector3(dest, &light->rec.directional.dir);
- break;
-
- case PLIGHT_POSITIONAL:
- phinprintf(dest, "light source colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &light->rec.positional.colr);
- phinprintf(dest, "light source position:\n");
- writepoint3(dest, &light->rec.positional.pos);
- phinprintf(dest, "attenuation coefficients = %f %f\n",
- light->rec.positional.coef[0], light->rec.positional.coef[1]);
- break;
-
- case PLIGHT_SPOT:
- phinprintf(dest, "light source colour:\n");
- phinprintf(dest, "colour type = ");
- writegcolr(dest, &light->rec.spot.colr);
- phinprintf(dest, "light source position:\n");
- writepoint3(dest, &light->rec.spot.pos);
- phinprintf(dest, "light source direction:\n");
- writevector3(dest, &light->rec.spot.dir);
- phinprintf(dest, "concentration exponent = %f\n",
- light->rec.spot.exp);
- phinprintf(dest, "attenuation coefficients = %f %f\n",
- light->rec.spot.coef[0], light->rec.spot.coef[1]);
- phinprintf(dest, "spread angle = %f\n", light->rec.spot.angle);
- break;
- }
- } /* writelightsrcbundle */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeparasurfcharacs(C(ptkedest) dest, C(Pint) psctype,
- C(Ppara_surf_characs *) psurf)
- PreANSI(ptkedest dest)
- PreANSI(Pint psctype)
- PreANSI(Ppara_surf_characs *psurf)
- {
- switch (psctype)
- {
- case PSC_NONE:
- break;
-
- case PSC_WS_DEP:
- break;
-
- case PSC_ISOPARAMETRIC_CURVES:
- writephigsenum(dest, PTKECURVEPLACE, psurf->psc_3.placement);
- writeinteger(dest, psurf->psc_3.u_count);
- writeinteger(dest, psurf->psc_3.v_count);
- break;
-
- case PSC_LEVEL_CURVES_MC:
- writepoint3(dest, &psurf->psc_4.origin);
- writevector3(dest, &psurf->psc_4.direction);
- writefloatlist(dest, &psurf->psc_4.params);
- break;
-
- case PSC_LEVEL_CURVES_WC:
- writepoint3(dest, &psurf->psc_5.origin);
- writevector3(dest, &psurf->psc_5.direction);
- writefloatlist(dest, &psurf->psc_5.params);
- break;
- }
- } /* writeparasurfcharacs */
-
- /*--------------------------------------------------------------------------*/
-
- static void writecovalarray(C(ptkedest) dest, C(Pint) type, C(Pint) num,
- C(Pcoval *) colours)
- PreANSI(ptkedest dest)
- PreANSI(Pint type)
- PreANSI(Pint num)
- PreANSI(Pcoval *colours)
- {
- Pint i;
-
- if (type == PINDIRECT)
- {
- for (i = 0; i < num; i++)
- writeintvalue(dest, colours[i].ind, PTKECOLOURIND);
- }
- else
- {
- for (i = 0; i < num; i++)
- writecobundl(dest, &colours[i].direct);
- }
- } /* writecovalarray */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointlist34(C(ptkedest) dest, C(Prational) rationality,
- C(Ppoint_list34 *) plist)
- PreANSI(ptkedest dest)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_list34 *plist)
- {
- Pint i, n;
- char prom[30];
-
- writeinteger(dest, plist->num_points);
- if (rationality == PRATIONAL)
- {
- for (i = 0; i < plist->num_points; i++)
- writepoint4(dest, &plist->points.point4d[i]);
- }
- else
- {
- for (i = 0; i < plist->num_points; i++)
- writepoint3(dest, &plist->points.point3d[i]);
- }
- } /* writepointlist34 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointgrid34(C(ptkedest) dest, C(Prational) rationality,
- C(Ppoint_grid34 *) plist)
- PreANSI(ptkedest dest)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_grid34 *plist)
- {
- Pint i, numpts;
- char prom[30];
-
- writeinteger(dest, plist->num_points.u_dim);
- writeinteger(dest, plist->num_points.v_dim);
- numpts = plist->num_points.u_dim * plist->num_points.v_dim;
- if (rationality == PRATIONAL)
- {
- for (i = 0; i < numpts; i++)
- writepoint4(dest, &plist->points.point4d[i]);
- }
- else
- {
- for (i = 0; i < numpts; i++)
- writepoint3(dest, &plist->points.point3d[i]);
- }
- } /* writepointgrid34 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepointlist23(C(ptkedest) dest, C(Prational) rationality,
- C(Ppoint_list23 *) plist)
- PreANSI(ptkedest dest)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_list23 *plist)
- {
- Pint i, n;
- char prom[30];
-
- writeinteger(dest, plist->num_points);
- if (rationality == PRATIONAL)
- {
- for (i = 0; i < plist->num_points; i++)
- writepoint3(dest, &plist->points.point3d[i]);
- }
- else
- {
- for (i = 0; i < plist->num_points; i++)
- writepoint(dest, &plist->points.point2d[i]);
- }
- } /* writepointlist23 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writefacetvdatalist3(C(ptkedest) dest, C(Pint) vflag,
- C(Pint) colour_model, C(Pint) nfa, C(Pfacet_vdata_list3 *) vdata)
- PreANSI(ptkedest dest)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint nfa)
- PreANSI(Pfacet_vdata_list3 *vdata)
- /*
- ** write list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint i, j;
- char prom[80];
-
- for (i = 0; i < nfa; i++)
- {
- writeinteger(dest, vdata[i].num_vertices);
- switch (vflag)
- {
- case PVERT_COORD:
- for (j = 0; j < vdata[i].num_vertices; j++)
- writepoint3(dest, &vdata[i].vertex_data.points[j]);
- break;
-
- case PVERT_COORD_COLOUR:
- for (j = 0; j < vdata[i].num_vertices; j++)
- {
- writepoint3(dest, &vdata[i].vertex_data.ptcolrs[j].point);
- if (colour_model == PINDIRECT)
- writeintvalue(dest, vdata[i].vertex_data.ptcolrs[j].colr.ind,
- PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model,
- &vdata[i].vertex_data.ptcolrs[j].colr);
- }
- break;
-
- case PVERT_COORD_NORMAL:
- for (j = 0; j < vdata[i].num_vertices; j++)
- {
- writepoint3(dest, &vdata[i].vertex_data.ptnorms[j].point);
- writevector3(dest, &vdata[i].vertex_data.ptnorms[j].norm);
- }
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- for (j = 0; j < vdata[i].num_vertices; j++)
- {
- writepoint3(dest, &vdata[i].vertex_data.ptconorms[j].point);
- if (colour_model == PINDIRECT)
- writeintvalue(dest, vdata[i].vertex_data.ptconorms[j].colr.ind,
- PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model,
- vdata[i].vertex_data.ptconorms[j].colr);
- writevector3(dest, vdata[i].vertex_data.ptconorms[j].norm);
- }
- break;
- }
- }
- } /* writefacetvdatalist3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writefacetvdataarr3(C(ptkedest) dest, C(Pint) vflag,
- C(Pint) colour_model, C(Pint) nv, C(Pfacet_vdata_arr3 *) vdata)
- PreANSI(ptkedest dest)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint nv)
- PreANSI(Pfacet_vdata_arr3 *vdata)
- /*
- ** write list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint i, j;
-
- switch (vflag)
- {
- case PVERT_COORD:
- for (i = 0; i < nv; i++)
- writepoint3(dest, &vdata->points[i]);
- break;
-
- case PVERT_COORD_COLOUR:
- for (i = 0; i < nv; i++)
- {
- writepoint3(dest, &vdata->ptcolrs[i].point);
- if (colour_model == PINDIRECT)
- writeintvalue(dest, vdata->ptcolrs[i].colr.ind, PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model,
- &vdata->ptcolrs[i].colr);
- }
- break;
-
- case PVERT_COORD_NORMAL:
- for (i = 0; i < nv; i++)
- {
- writepoint3(dest, &vdata->ptnorms[i].point);
- writevector3(dest, &vdata->ptnorms[i].norm);
- }
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- for (i = 0; i < nv; i++)
- {
- writepoint3(dest, &vdata->ptconorms[i].point);
- if (colour_model == PINDIRECT)
- writeintvalue(dest, vdata->ptconorms[i].colr.ind, PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model,
- &vdata->ptconorms[i].colr);
- writevector3(dest, &vdata->ptconorms[i].norm);
- }
- break;
- }
- } /* writefacetvdataarr3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writelinevdatalist3(C(ptkedest) dest, C(Pint) vflag,
- C(Pint) colour_model, C(Pint) nfa, C(Pline_vdata_list3 *) vdata)
- PreANSI(ptkedest dest)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint nfa)
- PreANSI(Pline_vdata_list3 *vdata)
- /*
- ** read list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint i, j;
- char prom[80];
-
- for (i = 0; i < nfa; i++)
- {
- writeinteger(dest, vdata[i].num_vertices);
- switch (vflag)
- {
- case PVERT_COORD:
- for (j = 0; j < vdata[i].num_vertices; j++)
- writepoint3(dest, &vdata[i].vertex_data.points[j]);
- break;
-
- case PVERT_COORD_COLOUR:
- for (j = 0; j < vdata[i].num_vertices; j++)
- {
- writepoint3(dest, &vdata[i].vertex_data.ptcolrs[j].point);
- if (colour_model == PINDIRECT)
- writeintvalue(dest, vdata[i].vertex_data.ptcolrs[j].colr.ind,
- PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model,
- &vdata[i].vertex_data.ptcolrs[j].colr);
- }
- break;
- }
- }
- } /* writelinevdatalist3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writefacetdata3(C(ptkedest) dest, C(Pint) fflag,
- C(Pint) colour_model, C(Pfacet_data3 *) fdata)
- PreANSI(ptkedest dest)
- PreANSI(Pint fflag)
- PreANSI(Pint colour_model)
- PreANSI(Pfacet_data3 *fdata)
- /*
- ** read facet data record.
- */
- {
- char prom[80];
-
- switch (fflag)
- {
- case PFACET_NONE:
- break;
-
- case PFACET_COLOUR:
- if (colour_model == PINDIRECT)
- writeintvalue(dest, fdata->colr.ind, PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model, &fdata->colr);
- break;
-
- case PFACET_NORMAL:
- writevector3(dest, &fdata->norm);
- break;
-
- case PFACET_COLOUR_NORMAL:
- if (colour_model == PINDIRECT)
- writeintvalue(dest, fdata->conorm.colr.ind, PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model, &fdata->conorm.colr);
- writevector3(dest, &fdata->conorm.norm);
- break;
- }
- } /* writefacetdata3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writefacetdataarr3(C(ptkedest) dest, C(Pint) fflag,
- C(Pint) colour_model, C(Pint) num, C(Pfacet_data_arr3 *) fdata)
- PreANSI(ptkedest dest)
- PreANSI(Pint fflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint num)
- PreANSI(Pfacet_data_arr3 *fdata)
- /*
- ** read facet data record.
- */
- {
- char prom[80];
- Pint i;
-
- switch (fflag)
- {
- case PFACET_NONE:
- break;
-
- case PFACET_COLOUR:
- if (colour_model == PINDIRECT)
- {
- for (i = 0; i < num; i++)
- writeintvalue(dest, fdata->colrs[i].ind, PTKECOLOURIND);
- }
- else
- {
- for (i = 0; i < num; i++)
- writedirectcolour(dest, colour_model, &fdata->colrs[i]);
- }
- break;
-
- case PFACET_NORMAL:
- for (i = 0; i < num; i++)
- writevector3(dest, &fdata->norms[i]);
- break;
-
- case PFACET_COLOUR_NORMAL:
- for (i = 0; i < num; i++)
- {
- if (colour_model == PINDIRECT)
- writeintvalue(dest, fdata->conorms[i].colr.ind, PTKECOLOURIND);
- else
- writedirectcolour(dest, colour_model, &fdata->conorms[i].colr);
- writevector3(dest, &fdata->conorms[i].norm);
- }
- break;
- }
- } /* writefacetdataarr3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeedgedatalist(C(ptkedest) dest, C(Pint) nfa,
- C(Pedge_data_list *) edata)
- PreANSI(ptkedest dest)
- PreANSI(Pint nfa)
- PreANSI(Pedge_data_list *edata)
- /*
- ** read list of nfa edge information.
- */
- {
- Pint i, j;
-
- for (i = 0; i < nfa; i++)
- {
- writeinteger(dest, edata[i].num_edges);
- for (j = 0; j < edata[i].num_edges; j++)
- writephigsenum(dest, PTKEEDGEF, edata[i].edgedata.edges[j]);
- }
- } /* writeedgedatalist */
-
- /*--------------------------------------------------------------------------*/
-
- static void writeedgedatalistlist(C(ptkedest) dest,
- C(Pedge_data_list_list *) edata)
- PreANSI(ptkedest dest)
- PreANSI(Pedge_data_list_list *edata)
- /*
- ** read list of edge lists information.
- */
- {
- Pint i, j;
- char prom[80];
-
- writeinteger(dest, edata->num_lists);
- for (i = 0; i < edata->num_lists; i++)
- {
- writeinteger(dest, edata->edgelist[i].num_edges);
- for (j = 0; j < edata->edgelist[i].num_edges; j++)
- writephigsenum(dest, PTKEEDGEF, edata->edgelist[i].edgedata.edges[j]);
- }
- } /* writeedgedatalistlist */
-
- /*--------------------------------------------------------------------------*/
-
- static void writetrimcurvelist(C(ptkedest) dest, C(Ptrimcurve_list *) tlist)
- PreANSI(ptkedest dest)
- PreANSI(Ptrimcurve_list *tlist)
- {
- Pint i;
-
- writeinteger(dest, tlist->num_curves);
- for (i = 0; i < tlist->num_curves; i++)
- {
- writephigsenum(dest, PTKEEDGEF, tlist->curves[i].visible);
- writephigsenum(dest, PTKERATIONAL, tlist->curves[i].rationality);
- writeinteger(dest, tlist->curves[i].order);
- writeinteger(dest, tlist->curves[i].approx_type);
- writereal(dest, tlist->curves[i].approx_val);
- writefloatlist(dest, &tlist->curves[i].knots);
- writereal(dest, tlist->curves[i].tmin);
- writereal(dest, tlist->curves[i].tmax);
- writepointlist23(dest, tlist->curves[i].rationality,
- &tlist->curves[i].cpts);
- }
- } /* writetrimcurvelist */
-
- /*--------------------------------------------------------------------------*/
-
- #endif
-
- static void writeelemcontent(C(ptkedest) dest, C(ptkselcontent *) elcont)
- PreANSI(ptkedest dest)
- PreANSI(ptkselcontent *elcont)
- {
- Pint i, numpts, namelen, ptindex, size;
- char elemname[100], str[100];
-
- ptk_getelemtypename(elcont->eltype, 100, elemname, &namelen);
- phinprintf(dest, "%s\n", elemname);
- switch (elcont->eltype)
- {
- case PELEM_NIL:
- break;
-
- case PELEM_POLYLINE3:
- case PELEM_POLYMARKER3:
- case PELEM_FILL_AREA3:
- writepointlst3(dest, &elcont->eldata->point_list3);
- break;
-
- case PELEM_POLYLINE:
- case PELEM_POLYMARKER:
- case PELEM_FILL_AREA:
- writepointlst(dest, &elcont->eldata->point_list);
- break;
-
- case PELEM_TEXT3:
- writepoint3(dest, &elcont->eldata->text3.pos);
- writevector3(dest, &elcont->eldata->text3.dir[0]);
- writevector3(dest, &elcont->eldata->text3.dir[1]);
- phinprintf(dest, "\"%s\"\n", elcont->eldata->text3.char_string);
- break;
-
- case PELEM_TEXT:
- writepoint(dest, &elcont->eldata->text.pos);
- phinprintf(dest, "\"%s\"\n", elcont->eldata->text.char_string);
- break;
-
- case PELEM_ANNO_TEXT_REL3:
- writepoint3(dest, &elcont->eldata->anno_text_rel3.ref_point);
- writepoint3(dest, &elcont->eldata->anno_text_rel3.offset);
- phinprintf(dest, "\"%s\"\n",
- elcont->eldata->anno_text_rel3.char_string);
- break;
-
- case PELEM_ANNO_TEXT_REL:
- writepoint(dest, &elcont->eldata->anno_text_rel.ref_point);
- writepoint(dest, &elcont->eldata->anno_text_rel.offset);
- phinprintf(dest, "\"%s\"\n", elcont->eldata->anno_text_rel.char_string);
- break;
-
- case PELEM_FILL_AREA_SET3:
- writeinteger(dest, elcont->eldata->point_list_list3.num_point_lists);
- for (i = 0; i < elcont->eldata->point_list_list3.num_point_lists; i++)
- {
- writepointlst3(dest,
- &elcont->eldata->point_list_list3.point_lists[i]);
- }
- break;
-
- case PELEM_FILL_AREA_SET:
- writeinteger(dest, elcont->eldata->point_list_list.num_point_lists);
- for (i = 0; i < elcont->eldata->point_list_list.num_point_lists; i++)
- {
- writepointlst(dest, &elcont->eldata->point_list_list.point_lists[i]);
- }
- break;
-
- case PELEM_CELL_ARRAY3:
- writepoint3(dest, &elcont->eldata->cell_array3.paral.p);
- writepoint3(dest, &elcont->eldata->cell_array3.paral.q);
- writepoint3(dest, &elcont->eldata->cell_array3.paral.r);
- writeinteger(dest, elcont->eldata->cell_array3.colr_array.dims.size_x);
- writeinteger(dest, elcont->eldata->cell_array3.colr_array.dims.size_y);
- writeintarray(dest,
- (elcont->eldata->cell_array3.colr_array.dims.size_x *
- elcont->eldata->cell_array3.colr_array.dims.size_y),
- elcont->eldata->cell_array3.colr_array.colr_array[i], PTKECOLOURIND);
- break;
-
- case PELEM_CELL_ARRAY:
- writepoint(dest, &elcont->eldata->cell_array.rect.p);
- writepoint(dest, &elcont->eldata->cell_array.rect.q);
- writeinteger(dest, elcont->eldata->cell_array.colr_array.dims.size_x);
- writeinteger(dest, elcont->eldata->cell_array.colr_array.dims.size_y);
- writeintarray(dest,
- (elcont->eldata->cell_array.colr_array.dims.size_x *
- elcont->eldata->cell_array.colr_array.dims.size_y),
- elcont->eldata->cell_array.colr_array.colr_array[i], PTKECOLOURIND);
- break;
-
- case PELEM_GDP3:
- writeinteger(dest, elcont->eldata->gdp3.id);
- break;
-
- case PELEM_GDP:
- writeinteger(dest, elcont->eldata->gdp.id);
- break;
-
- case PELEM_LINE_IND:
- case PELEM_MARKER_IND:
- case PELEM_TEXT_IND:
- case PELEM_INT_IND:
- case PELEM_EDGE_IND:
- case PELEM_LINETYPE:
- case PELEM_MARKER_TYPE:
- case PELEM_TEXT_FONT:
- case PELEM_ANNO_STYLE:
- case PELEM_INT_STYLE_IND:
- case PELEM_EDGETYPE:
- case PELEM_HLHSR_ID:
- writeinteger(dest, elcont->eldata->int_data);
- break;
-
- case PELEM_EDGE_COLR_IND:
- case PELEM_INT_COLR_IND:
- case PELEM_TEXT_COLR_IND:
- case PELEM_MARKER_COLR_IND:
- case PELEM_LINE_COLR_IND:
- writeintvalue(dest, elcont->eldata->int_data, PTKECOLOURIND);
- break;
-
- case PELEM_VIEW_IND:
- writeintvalue(dest, elcont->eldata->int_data, PTKEVIEWIND);
- break;
-
- case PELEM_LABEL:
- writeintvalue(dest, elcont->eldata->int_data, PTKELABELVAL);
- break;
-
- case PELEM_PICK_ID:
- writeintvalue(dest, elcont->eldata->int_data, PTKEPICKID);
- break;
-
- case PELEM_LINEWIDTH:
- case PELEM_MARKER_SIZE:
- case PELEM_CHAR_EXPAN:
- case PELEM_CHAR_SPACE:
- case PELEM_CHAR_HT:
- case PELEM_ANNO_CHAR_HT:
- case PELEM_EDGEWIDTH:
- writereal(dest, elcont->eldata->float_data);
- break;
-
- case PELEM_EXEC_STRUCT:
- writeintvalue(dest, elcont->eldata->int_data, PTKESTRUCTID);
- break;
-
- case PELEM_TEXT_PREC:
- writephigsenum(dest, PTKETXPREC, elcont->eldata->text_prec);
- break;
-
- case PELEM_CHAR_UP_VEC:
- case PELEM_ANNO_CHAR_UP_VEC:
- writevector(dest, &elcont->eldata->char_up_vec);
- break;
-
- case PELEM_TEXT_PATH:
- case PELEM_ANNO_PATH:
- writephigsenum(dest, PTKETXPATH, elcont->eldata->text_path);
- break;
-
- case PELEM_TEXT_ALIGN:
- case PELEM_ANNO_ALIGN:
- writephigsenum(dest, PTKETXHOR, elcont->eldata->text_align.hor);
- writephigsenum(dest, PTKETXVER, elcont->eldata->text_align.vert);
- break;
-
- case PELEM_INT_STYLE:
- writephigsenum(dest, PTKEINTERSTYLE, elcont->eldata->int_style);
- break;
-
- case PELEM_EDGE_FLAG:
- writephigsenum(dest, PTKEEDGEF, elcont->eldata->edge_flag);
- break;
-
- case PELEM_PAT_SIZE:
- case PELEM_PAT_REF_POINT:
- writepoint(dest, &elcont->eldata->pat_ref_point);
- break;
-
- case PELEM_PAT_REF_POINT_VECS:
- writepoint3(dest, &elcont->eldata->pat_ref_point_vecs.ref_point);
- writevector3(dest, &elcont->eldata->pat_ref_point_vecs.ref_vec[0]);
- writevector3(dest, &elcont->eldata->pat_ref_point_vecs.ref_vec[1]);
- break;
-
- case PELEM_ADD_NAMES_SET:
- case PELEM_REMOVE_NAMES_SET:
- writeintlst(dest, &elcont->eldata->names, PTKENAME);
- break;
-
- case PELEM_INDIV_ASF:
- writephigsenum(dest, PTKEATTRID, elcont->eldata->asf.id);
- writephigsenum(dest, PTKEASF, elcont->eldata->asf.source);
- break;
-
- case PELEM_LOCAL_MODEL_TRAN3:
- writematrix3(dest, elcont->eldata->local_tran3.matrix);
- writephigsenum(dest, PTKECOMPTYPE,
- elcont->eldata->local_tran3.compose_type);
- break;
-
- case PELEM_LOCAL_MODEL_TRAN:
- writematrix3(dest, elcont->eldata->local_tran.matrix);
- writephigsenum(dest, PTKECOMPTYPE,
- elcont->eldata->local_tran.compose_type);
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN3:
- writematrix3(dest, elcont->eldata->global_tran3);
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN:
- writematrix(dest, elcont->eldata->global_tran);
- break;
-
- case PELEM_MODEL_CLIP_VOL3:
- writeinteger(dest, elcont->eldata->model_clip3.op);
- /* half space list */
- break;
-
- case PELEM_MODEL_CLIP_VOL:
- writeinteger(dest, elcont->eldata->model_clip.op);
- /* half space list */
- break;
-
- case PELEM_MODEL_CLIP_IND:
- writephigsenum(dest, PTKECLIP, elcont->eldata->clip_ind);
- break;
-
- case PELEM_RESTORE_MODEL_CLIP_VOL:
- break;
-
- case PELEM_APPL_DATA:
- writeinteger(dest, elcont->eldata->appl_data.size);
- phinprintf(dest, "\"%s\"\n", elcont->eldata->appl_data.data);
- break;
-
- case PELEM_GSE:
- writeinteger(dest, elcont->eldata->gse.id);
- break;
- /* PHIGS PLUS elements */
- #ifdef SUN
- case PELEM_POLYLINE_SET3_DATA:
- writeinteger(dest, elcont->eldata->plsd3.vflag);
- writeinteger(dest, elcont->eldata->plsd3.colr_model);
- writeinteger(dest, elcont->eldata->plsd3.npl);
- writelinevdatalist3(dest, elcont->eldata->plsd3.vflag,
- elcont->eldata->plsd3.colr_model,
- elcont->eldata->plsd3.npl, &elcont->eldata->plsd3.vdata);
- break;
-
- case PELEM_FILL_AREA_SET3_DATA:
- writeinteger(dest, elcont->eldata->fasd3.fflag);
- writeinteger(dest, elcont->eldata->fasd3.eflag);
- writeinteger(dest, elcont->eldata->fasd3.vflag);
- writeinteger(dest, elcont->eldata->fasd3.colr_model);
- writefacetdata3(dest, elcont->eldata->fasd3.fflag,
- elcont->eldata->fasd3.colr_model,
- &elcont->eldata->fasd3.fdata);
- writeinteger(dest, elcont->eldata->fasd3.nfa);
- if (elcont->eldata->fasd3.eflag == PEDGE_VISIBILITY)
- writeedgedatalist(dest, elcont->eldata->fasd3.nfa,
- elcont->eldata->fasd3.edata);
- writefacetvdatalist3(dest, elcont->eldata->fasd3.vflag,
- elcont->eldata->fasd3.colr_model,
- elcont->eldata->fasd3.nfa,
- elcont->eldata->fasd3.vdata);
- break;
-
- case PELEM_TRI_STRIP3_DATA:
- writeinteger(dest, elcont->eldata->tsd3.fflag);
- writeinteger(dest, elcont->eldata->tsd3.vflag);
- writeinteger(dest, elcont->eldata->tsd3.colr_model);
- writeinteger(dest, elcont->eldata->tsd3.nv);
- writefacetdataarr3(dest, elcont->eldata->tsd3.fflag,
- elcont->eldata->tsd3.colr_model,
- elcont->eldata->tsd3.nv,
- &elcont->eldata->tsd3.fdata);
- writefacetvdataarr3(dest, elcont->eldata->tsd3.vflag,
- elcont->eldata->tsd3.colr_model,
- elcont->eldata->tsd3.nv,
- &elcont->eldata->tsd3.vdata);
- break;
-
- case PELEM_QUAD_MESH3_DATA:
- writeinteger(dest, elcont->eldata->qmd3.fflag);
- writeinteger(dest, elcont->eldata->qmd3.vflag);
- writeinteger(dest, elcont->eldata->qmd3.colr_model);
- writeintsize(dest, &elcont->eldata->qmd3.dim);
- numpts = elcont->eldata->qmd3.dim.size_x *
- elcont->eldata->qmd3.dim.size_y;
- writefacetdataarr3(dest, elcont->eldata->qmd3.fflag,
- elcont->eldata->qmd3.colr_model,
- numpts, &elcont->eldata->qmd3.fdata);
- writefacetvdataarr3(dest, elcont->eldata->qmd3.vflag,
- elcont->eldata->qmd3.colr_model,
- numpts, &elcont->eldata->qmd3.vdata);
- break;
-
- case PELEM_SET_OF_FILL_AREA_SET3_DATA:
- writeinteger(dest, elcont->eldata->sofas3.fflag);
- writeinteger(dest, elcont->eldata->sofas3.eflag);
- writeinteger(dest, elcont->eldata->sofas3.vflag);
- writeinteger(dest, elcont->eldata->sofas3.colr_model);
- writeinteger(dest, elcont->eldata->sofas3.num_sets);
- writefacetdataarr3(dest, elcont->eldata->sofas3.fflag,
- elcont->eldata->sofas3.colr_model,
- elcont->eldata->sofas3.num_sets,
- &elcont->eldata->sofas3.fdata);
- if (elcont->eldata->sofas3.eflag == PEDGE_VISIBILITY)
- writeedgedatalistlist(dest, elcont->eldata->sofas3.num_sets,
- elcont->eldata->sofas3.edata);
- writeintlistlist(dest, elcont->eldata->sofas3.num_sets,
- elcont->eldata->sofas3.vlist);
- writefacetvdatalist3(dest, elcont->eldata->sofas3.vflag,
- elcont->eldata->sofas3.colr_model,
- elcont->eldata->sofas3.num_sets,
- &elcont->eldata->sofas3.vdata);
- break;
-
- case PELEM_NUNI_BSP_CURVE:
- writeinteger(dest, elcont->eldata->nurb_curve.order);
- writefloatlist(dest, &elcont->eldata->nurb_curve.knots);
- writephigsenum(dest, PTKERATIONAL,
- elcont->eldata->nurb_curve.rationality);
- writepointlist34(dest, elcont->eldata->nurb_curve.rationality,
- &elcont->eldata->nurb_curve.cpts);
- writereal(dest, elcont->eldata->nurb_curve.min);
- writereal(dest, elcont->eldata->nurb_curve.max);
- break;
-
- case PELEM_NUNI_BSP_SURF:
- writeinteger(dest, elcont->eldata->nurb_surf.u_order);
- writeinteger(dest, elcont->eldata->nurb_surf.v_order);
- writefloatlist(dest, &elcont->eldata->nurb_surf.uknots);
- writefloatlist(dest, &elcont->eldata->nurb_surf.vknots);
- writephigsenum(dest, PTKERATIONAL,
- elcont->eldata->nurb_surf.rationality);
- writepointgrid34(dest, elcont->eldata->nurb_surf.rationality,
- &elcont->eldata->nurb_surf.grid);
- writeinteger(dest, elcont->eldata->nurb_surf.num_trim_loops);
- for (i = 0; i < elcont->eldata->nurb_surf.num_trim_loops; i++)
- writetrimcurvelist(dest, &elcont->eldata->nurb_surf.trim_loops[i]);
- break;
-
- case PELEM_CELL_ARRAY3_PLUS:
- writeparal(dest, &elcont->eldata->cell_array_plus.paral);
- writeintsize(dest, &elcont->eldata->cell_array_plus.colr_array.dims);
- writeinteger(dest, elcont->eldata->cell_array_plus.colr_array.type);
- writecovalarray(dest,
- elcont->eldata->cell_array_plus.colr_array.colr_array);
- break;
-
- case PELEM_TEXT_COLR:
- case PELEM_MARKER_COLR:
- case PELEM_EDGE_COLR:
- case PELEM_LINE_COLR:
- case PELEM_INT_COLR:
- case PELEM_BACK_INT_COLR:
- writegcolr(dest, &elcont->eldata->colr);
- break;
-
- case PELEM_CURVE_APPROX_CRIT:
- writeinteger(dest, elcont->eldata->curv_approx.type);
- writereal(dest, elcont->eldata->curv_approx.value);
- break;
-
- case PELEM_LINE_SHAD_METH:
- case PELEM_BACK_INT_STYLE_IND:
- case PELEM_INT_SHAD_METH:
- case PELEM_BACK_INT_SHAD_METH:
- case PELEM_INT_REFL_EQN:
- case PELEM_BACK_INT_REFL_EQN:
- case PELEM_DCUE_IND:
- case PELEM_COLR_MAP_IND:
- case PELEM_RENDERING_COLR_MODEL:
- writeinteger(dest, elcont->eldata->int_data);
- break;
-
- case PELEM_BACK_INT_STYLE:
- writephigsenum(dest, PTKEINTERSTYLE, elcont->eldata->int_style);
- break;
-
- case PELEM_REFL_PROPS:
- case PELEM_BACK_REFL_PROPS:
- writereflprops(dest, &elcont->eldata->props);
- break;
-
- case PELEM_SURF_APPROX_CRIT:
- writeinteger(dest, elcont->eldata->surf_approx.type);
- writereal(dest, elcont->eldata->surf_approx.u_val);
- writereal(dest, elcont->eldata->surf_approx.v_val);
- break;
-
- case PELEM_PARA_SURF_CHARACS:
- writeinteger(dest, elcont->eldata->para_surf_characs.type);
- writeparasurfcharacs(dest, elcont->eldata->para_surf_characs.type,
- &elcont->eldata->para_surf_characs.data);
- break;
-
- case PELEM_FACE_DISTING_MODE:
- writephigsenum(dest, PTKEDISTINGMODE, elcont->eldata->disting_mode);
- break;
-
- case PELEM_FACE_CULL_MODE:
- writephigsenum(dest, PTKECULLMODE, elcont->eldata->cull_mode);
- break;
-
- case PELEM_LIGHT_SRC_STATE:
- writeintlst(dest, &elcont->eldata->lss.activation);
- writeintlst(dest, &elcont->eldata->lss.deactivation);
- break;
- #endif
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writelnbundl(C(ptkedest) dest, C(Pline_bundle *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pline_bundle *bundl)
- {
- phinprintf(dest, "linetype = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "linewidth scale factor = ");
- writereal(dest, bundl->width);
- phinprintf(dest, "line colour = ");
- writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writemkbundl(C(ptkedest) dest, C(Pmarker_bundle *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pmarker_bundle *bundl)
- {
- phinprintf(dest, "markertype = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "marker size scale factor = ");
- writereal(dest, bundl->size );
- phinprintf(dest, "marker colour = ");
- writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writetxbundl(C(ptkedest) dest, C(Ptext_bundle *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Ptext_bundle *bundl)
- {
- phinprintf(dest, "text font = ");
- writeinteger(dest, bundl->font);
- phinprintf(dest, "text precision = ");
- writephigsenum(dest, PTKETXPREC, bundl->prec);
- phinprintf(dest, "character expansion factor = ");
- writereal(dest, bundl->char_expan);
- phinprintf(dest, "character spacing = ");
- writereal(dest, bundl->char_space);
- phinprintf(dest, "text colour = ");
- writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeinterbundl(C(ptkedest) dest, C(Pint_bundle *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pint_bundle *bundl)
- {
- phinprintf(dest, "interior style = ");
- writephigsenum(dest, PTKEINTERSTYLE, bundl->style);
- phinprintf(dest, "interior style index = ");
- writeinteger(dest, bundl->style_ind);
- phinprintf(dest, "interior colour = ");
- writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeedgebundl(C(ptkedest) dest, C(Pedge_bundle *) bundl)
- PreANSI(ptkedest dest)
- PreANSI(Pedge_bundle *bundl)
- {
- phinprintf(dest, "edge flag = ");
- writephigsenum(dest, PTKEEDGEF, bundl->flag);
- phinprintf(dest, "edge type = ");
- writeinteger(dest, bundl->type);
- phinprintf(dest, "edgewidth scale factor = ");
- writereal(dest, bundl->width);
- phinprintf(dest, "edge colour = ");
- writeintvalue(dest, bundl->colr_ind, PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writelnattr(C(ptkedest) dest, C(Pline_attrs *) attr)
- PreANSI(ptkedest dest)
- PreANSI(Pline_attrs *attr)
- {
- phinprintf(dest, "linetype asf = ");
- writephigsenum(dest, PTKEASF, attr->type_asf);
- phinprintf(dest, "line width asf = ");
- writephigsenum(dest, PTKEASF, attr->width_asf);
- phinprintf(dest, "line colour asf = ");
- writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
- phinprintf(dest, "line bundle index = ");
- writeinteger(dest, attr->ind);
- writelnbundl(dest, &attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeinterattr(C(ptkedest) dest, C(Pint_attrs *) attr)
- PreANSI(ptkedest dest)
- PreANSI(Pint_attrs *attr)
- {
- phinprintf(dest, "interior asf = ");
- writephigsenum(dest, PTKEASF, attr->style_asf);
- phinprintf(dest, "interior style asf = ");
- writephigsenum(dest, PTKEASF, attr->style_ind_asf);
- phinprintf(dest, "interior colour asf = ");
- writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
- phinprintf(dest, "interior bundle index = ");
- writeinteger(dest, attr->ind);
- writeinterbundl(dest, &attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writeedgeattr(C(ptkedest) dest, C(Pedge_attrs *) attr)
- PreANSI(ptkedest dest)
- PreANSI(Pedge_attrs *attr)
- {
- phinprintf(dest, "edge flag asf = ");
- writephigsenum(dest, PTKEASF, attr->flag_asf);
- phinprintf(dest, "edge width asf = ");
- writephigsenum(dest, PTKEASF, attr->width_asf);
- phinprintf(dest, "edge colour asf = ");
- writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
- phinprintf(dest, "edge bundle index = ");
- writeinteger(dest, attr->ind);
- writeedgebundl(dest, &attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writemkattr(C(ptkedest) dest, C(Pmarker_attrs *) attr)
- PreANSI(ptkedest dest)
- PreANSI(Pmarker_attrs *attr)
- {
- phinprintf(dest, "marker type asf = ");
- writephigsenum(dest, PTKEASF, attr->type_asf);
- phinprintf(dest, "marker size asf = ");
- writephigsenum(dest, PTKEASF, attr->size_asf);
- phinprintf(dest, "marker colour asf = ");
- writephigsenum(dest, PTKEASF, attr->colr_ind_asf);
- phinprintf(dest, "marker bundle index = ");
- writeinteger(dest, attr->ind);
- writemkbundl(dest, &attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void writechoicerec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pchoice_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pchoice_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- switch (pet)
- {
- case 1:
- break;
-
- case 3:
- {
- Pint i;
- char **chstrings;
-
- phinprintf(dest, "number of choice strings = ");
- writeinteger(dest, rec->pets.pet_r3.num_strings);
- for (i = 0; i < rec->pets.pet_r3.num_strings; i++)
- phinprintf(dest, "choice string = %s\n",
- rec->pets.pet_r3.strings[i]);
- }
- break;
- }
- break;
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- break;
-
- default: break;
- }
- #endif
- } /* writechoicerec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writechoicerec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pchoice_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pchoice_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- writechoicerec(dest, device, pet, (Pchoice_data *)rec);
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- break;
-
- default: break;
- }
- #endif
- } /* writechoicerec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writelocrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Ploc_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ploc_data *rec)
- {
- Pint i;
-
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- switch (pet)
- {
- case 1:
- case 2:
- case 3:
- break;
-
- case -2:
- phinprintf(dest, "crosshair colour index = ");
- writeintvalue(dest, rec->pets.pet_u2.crosshair_colr, PTKECOLOURIND);
- break;
-
- case -4:
- writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
- break;
-
- case -5:
- writelnbundl(dest, &rec->pets.pet_u5.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- switch (pet)
- {
- case 1:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_r1.loc_colr_ind, PTKECOLOURIND);
- break;
-
- case 2:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_r2.loc_colr_ind, PTKECOLOURIND);
- break;
-
- case 3:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_r3.loc_colr_ind, PTKECOLOURIND);
- break;
-
- case 4:
- writelnattr(dest, &rec->pets.pet_r4.line_attrs);
- break;
-
- case 5:
- writephigsenum(dest, PTKECONTROL,
- rec->pets.pet_r5.line_fill_ctrl_flag);
- switch (rec->pets.pet_r5.line_fill_ctrl_flag)
- {
- case PFLAG_LINE:
- writelnattr(dest, &rec->pets.pet_r5.attrs.line_attrs);
- break;
-
- case PFLAG_FILL:
- writeinterattr(dest, &rec->pets.pet_r5.attrs.int_attrs);
- break;
-
- case PFLAG_FILL_SET:
- writeinterattr(dest,
- &rec->pets.pet_r5.attrs.fill_set.int_attrs);
- writeedgeattr(dest,
- &rec->pets.pet_r5.attrs.fill_set.edge_attrs);
- break;
- }
- break;
-
- case 6:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_r6.loc_colr_ind, PTKECOLOURIND);
- break;
-
- case -1:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_u1.loc_colr_ind, PTKECOLOURIND);
- phinprintf(dest, "rectangle height = %f\n",
- rec->pets.pet_u1.rect_height);
- phinprintf(dest, "rectangle width = %f\n",
- rec->pets.pet_u1.rect_width);
- break;
-
- case -2:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_u2.loc_colr_ind, PTKECOLOURIND);
- phinprintf(dest, "attachment point: ");
- writepoint3(dest, &rec->pets.pet_u2.attach_point);
- phinprintf(dest, "number of point lists = %d\n",
- rec->pets.pet_u2.num_point_lists);
- for (i = 0; i < rec->pets.pet_u2.num_point_lists; i++)
- writepointlst3(dest, &rec->pets.pet_u2.point_lists[i]);
- break;
-
- case -3:
- phinprintf(dest, "locator colour index = ");
- writeintvalue(dest, rec->pets.pet_u3.loc_colr_ind, PTKECOLOURIND);
- phinprintf(dest, "structure identifier = ");
- writeintvalue(dest, rec->pets.pet_u3.struct_id, PTKESTRUCTID);
- phinprintf(dest, "attachment point: ");
- writepoint3(dest, &rec->pets.pet_u3.attach_point);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writelocrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writelocrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Ploc_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ploc_data3 *rec)
- {
- Pint i;
-
- /* Implementation dependent code */
- #ifdef SUN
- writelocrec(dest, device, pet, (Ploc_data *)rec);
- #endif
- #ifdef HP
- writelocrec(dest, device, pet, (Ploc_data *)rec);
- #endif
- } /* writelocrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepickrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Ppick_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ppick_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- switch (pet)
- {
- case 1:
- break;
-
- case 2:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_r2.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_r2.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_r2.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_r2.ap_size);
- break;
-
- case 3:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_r3.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_r3.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_r3.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_r3.ap_size);
- break;
-
- case -1:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_u1.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_u1.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_u1.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_u1.ap_size);
- break;
-
- case -2:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_u2.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_u2.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_u2.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_u2.ap_size);
- break;
-
- case -3:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_u3.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_u3.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_u3.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_u3.ap_size);
- break;
-
- case -4:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_u4.highl_colr, PTKECOLOURIND);
- phinprintf(dest, "number of times to blink = ");
- writeinteger(dest, rec->pets.pet_u4.highl_count);
- phinprintf(dest, "number of seconds per half blink = ");
- writeinteger(dest, rec->pets.pet_u4.highl_duration);
- phinprintf(dest, "aperture size = ");
- writereal(dest, &rec->pets.pet_u4.ap_size);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- switch (pet)
- {
- case 1:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_r1.highl_colr_ind,
- PTKECOLOURIND);
- phinprintf(dest, "X dimension of aperture = %f\n",
- rec->pets.pet_r1.x_dim);
- phinprintf(dest, "Y dimension of aperture = %f\n",
- rec->pets.pet_r1.y_dim);
- phinprintf(dest, "Z dimension of aperture = %f\n",
- rec->pets.pet_r1.z_dim);
- break;
-
- case 2:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_r2.highl_colr_ind,
- PTKECOLOURIND);
- phinprintf(dest, "X dimension of aperture = %f\n",
- rec->pets.pet_r2.x_dim);
- phinprintf(dest, "Y dimension of aperture = %f\n",
- rec->pets.pet_r2.y_dim);
- phinprintf(dest, "Z dimension of aperture = %f\n",
- rec->pets.pet_r2.z_dim);
- break;
-
- case 3:
- phinprintf(dest, "highlight colour index = ");
- writeintvalue(dest, rec->pets.pet_r3.highl_colr_ind,
- PTKECOLOURIND);
- phinprintf(dest, "X dimension of aperture = %f\n",
- rec->pets.pet_r3.x_dim);
- phinprintf(dest, "Y dimension of aperture = %f\n",
- rec->pets.pet_r3.y_dim);
- phinprintf(dest, "Z dimension of aperture = %f\n",
- rec->pets.pet_r3.z_dim);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writepickrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writepickrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Ppick_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ppick_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- writepickrec(dest, device, pet, (Ppick_data *)rec);
- #endif
- #ifdef HP
- writepickrec(dest, device, pet, (Ppick_data *)rec);
- #endif
- } /* writepickrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writestringrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pstring_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstring_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- phinprintf(dest, "buffer size = %d\n", rec->in_buf_size);
- phinprintf(dest, "initial position = %d\n", rec->init_pos);
- switch (pet)
- {
- case 1:
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- phinprintf(dest, "buffer size = %d\n", rec->in_buf_size);
- phinprintf(dest, "initial position = %d\n", rec->init_pos);
- switch (pet)
- {
- case 1:
- phinprintf(dest, "text colour index = ");
- writeintvalue(dest, rec->pets.pet_r1.text_colr_ind,
- PTKECOLOURIND);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writestringrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writestringrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pstring_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstring_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- writestringrec(dest, device, pet, (Pstring_data *)rec);
- #endif
- } /* writestringrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writestrokerec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pstroke_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstroke_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- phinprintf(dest, "buffer size = ");
- writeinteger(dest, rec->in_buf_size);
- phinprintf(dest, "editing position = ");
- writeinteger(dest, rec->init_pos);
- phinprintf(dest, "x interval = ");
- writereal(dest, rec->x_interval);
- phinprintf(dest, "y interval = ");
- writereal(dest, rec->y_interval);
- phinprintf(dest, "time interval = ");
- writereal(dest, rec->time_interval);
- switch (pet)
- {
- case 1:
- break;
-
- case -3:
- writemkbundl(dest, &rec->pets.pet_u3.marker_bundle);
- break;
-
- case -4:
- writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- phinprintf(dest, "buffer size = ");
- writeinteger(dest, rec->in_buf_size);
- phinprintf(dest, "editing position = ");
- writeinteger(dest, rec->init_pos);
- phinprintf(dest, "x interval = ");
- writereal(dest, rec->x_interval);
- phinprintf(dest, "y interval = ");
- writereal(dest, rec->y_interval);
- phinprintf(dest, "time interval = ");
- writereal(dest, rec->time_interval);
- switch (pet)
- {
- case 1:
- writelnattr(dest, &rec->pets.pet_r1.line_attrs);
- break;
-
- case 2:
- break;
-
- case 3:
- writemkattr(dest, &rec->pets.pet_r3.marker_attrs);
- break;
-
- case 4:
- writelnattr(dest, &rec->pets.pet_r4.line_attrs);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writestrokerec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writestrokerec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pstroke_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstroke_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- phinprintf(dest, "buffer size = ");
- writeinteger(dest, rec->in_buf_size);
- phinprintf(dest, "editing position = ");
- writeinteger(dest, rec->init_pos);
- phinprintf(dest, "x interval = ");
- writereal(dest, rec->x_interval);
- phinprintf(dest, "y interval = ");
- writereal(dest, rec->y_interval);
- phinprintf(dest, "z interval = ");
- writereal(dest, rec->z_interval);
- phinprintf(dest, "time interval = ");
- writereal(dest, rec->time_interval);
- switch (pet)
- {
- case 1:
- break;
-
- case -3:
- writemkbundl(dest, &rec->pets.pet_u3.marker_bundle);
- break;
-
- case -4:
- writelnbundl(dest, &rec->pets.pet_u4.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- phinprintf(dest, "buffer size = ");
- writeinteger(dest, rec->in_buf_size);
- phinprintf(dest, "editing position = ");
- writeinteger(dest, rec->init_pos);
- phinprintf(dest, "x interval = ");
- writereal(dest, rec->x_interval);
- phinprintf(dest, "y interval = ");
- writereal(dest, rec->y_interval);
- phinprintf(dest, "z interval = ");
- writereal(dest, rec->z_interval);
- phinprintf(dest, "time interval = ");
- writereal(dest, rec->time_interval);
- switch (pet)
- {
- case 1:
- writelnattr(dest, &rec->pets.pet_r1.line_attrs);
- break;
-
- case 2:
- break;
-
- case 3:
- writemkattr(dest, &rec->pets.pet_r3.marker_attrs);
- break;
-
- case 4:
- writelnattr(dest, &rec->pets.pet_r4.line_attrs);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writestrokerec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void writevalrec(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pval_data *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pval_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- phinprintf(dest, "low limit = ");
- writereal(dest, rec->low);
- phinprintf(dest, "high limit = ");
- writereal(dest, rec->high);
- switch (pet)
- {
- case 1:
- break;
-
- case -1:
- phinprintf(dest, "label = %s\n", rec->pets.pet_u1.label);
- phinprintf(dest, "format = %s\n", rec->pets.pet_u1.format);
- phinprintf(dest, "low label = %s\n", rec->pets.pet_u1.low_label);
- phinprintf(dest, "high label = %s\n", rec->pets.pet_u1.high_label);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- phinprintf(dest, "low limit = ");
- writereal(dest, rec->low_value);
- phinprintf(dest, "high limit = ");
- writereal(dest, rec->high_value);
- switch (pet)
- {
- case 1:
- phinprintf(dest, "slider outline colour index = ");
- writeintvalue(dest, rec->pets.pet_r1.slider_colr_ind,
- PTKECOLOURIND);
- break;
- }
-
- default: break;
- }
- #endif
- } /* writevalrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void writevalrec3(C(ptkedest) dest, C(Pint) device, C(Pint) pet,
- C(Pval_data3 *) rec)
- PreANSI(ptkedest dest)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pval_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- writevalrec(dest, device, pet, (Pval_data *)rec);
- #endif
- #ifdef HP
- writevalrec(dest, device, pet, (Pval_data *)rec);
- #endif
- } /* writevalrec3 */
-
- /*--------------------------------------------------------------------------*/
- /*-------------------- general reading functions ---------------------------*/
- /*--------------------------------------------------------------------------*/
-
- static void checkabort(C(char *) str)
- PreANSI(char *str)
- /* check if ABORT has been entered to abort a phigs function call */
- {
- if ((strncmp(str, "ABORT", 5) == 0) && (phinteron))
- {
- phinprintf(PTKEINFORM, "Phinter: function aborted.\n");
- longjmp(PFABORT, 1);
- }
- } /* checkabort */
-
- /*--------------------------------------------------------------------------*/
-
- static void stripstr(C(char *) str, C(char) stripch)
- PreANSI(char *str)
- PreANSI(char stripch)
- /* strip all 'stripch' characters from string */
- {
- Pint i, j;
- ptkboolean stripped;
- char ch;
-
- i = j = 0;
- stripped = FALSE;
- while (!stripped)
- {
- ch = str[i];
- if (ch == '\0')
- stripped = TRUE;
- else
- if (ch != stripch)
- {
- str[j] = ch;
- j++;
- }
- i++;
- }
- str[j] = '\0';
- } /* stripstr */
-
- /*--------------------------------------------------------------------------*/
-
- static void readquote(C(char *) str, C(char *) prom)
- PreANSI(char *str)
- PreANSI(char *prom)
- /*
- ** Reads a string. if the first non-blank character found is
- ** a double quote ("), the string is assumed to quoted, and must
- ** be "string", on one line. otherwise, the next sequence of
- ** non-blank characters will be returned as the string.
- */
- {
- Pint wi;
- Pint ch;
- ptkboolean finished;
-
- if (fileswitch)
- {
- set_i_prompt(prom);
- wi = 0;
- finished = FALSE;
- ch = getc(inputscript);
- while ((ch == ' ' || ch == '\n') && (ch != EOF))
- ch = getc(inputscript);
- if (ch == EOF)
- {
- str[wi++] = EOF;
- finished = TRUE;
- }
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if ((ch == '"') && (wi > 1))
- finished = TRUE;
- else
- ch = getc(inputscript);
- }
- }
- else
- {
- char prompt[80];
-
- sprintf(prompt, "%s> ", prom);
- ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
- }
- str[wi] = '\0';
- stripstr(str, '"');
- checkabort(str);
- } /* readquote */
-
- /*--------------------------------------------------------------------------*/
-
- static void readstring(C(char *) str, C(char *) prom)
- PreANSI(char *str)
- PreANSI(char *prom)
- /*
- ** Reads a string. if the first non-blank character found is
- ** a double quote ("), the string is assumed to quoted, and must
- ** be "string", on one line. otherwise, the next sequence of
- ** non-blank characters will be returned as the string
- */
- {
- Pint wi;
- Pint ch;
- ptkboolean finished;
-
- if (fileswitch)
- {
- set_i_prompt(prom);
- wi = 0;
- finished = FALSE;
- ch = getc(inputscript);
- while ((ch == ' ' || ch == '\n') && (ch != EOF))
- ch = getc(inputscript);
- if (ch == EOF)
- {
- str[wi++] = EOF;
- finished = TRUE;
- }
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if (ch == '\0')
- finished = TRUE;
- else
- if (ch == '\n' || ch == ' ' || ch == EOF)
- {
- finished = TRUE;
- if (str[0] != '!')
- wi--;
- }
- else
- ch = getc(inputscript);
- }
- }
- else
- {
- char prompt[80];
-
- sprintf(prompt, "%s> ", prom);
- ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
- }
- str[wi] = '\0';
- checkabort(str);
- } /* readstring */
-
- /*--------------------------------------------------------------------------*/
-
- static ptkboolean readfunction(C(char *) str)
- PreANSI(char *str)
- {
- readstring(str, default_prompt_string);
- if (str != '\0')
- return TRUE;
- else
- return FALSE;
- } /* readfunction */
-
- /*--------------------------------------------------------------------------*/
-
- static void readargument(C(char *) str, C(char *) prom)
- PreANSI(char *str)
- PreANSI(char *prom)
- {
- readstring(str, prom);
- stripstr(str, '"');
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\"%s\" ", str);
- } /* readargument */
-
- /*--------------------------------------------------------------------------*/
-
- static Pint readinteger(C(char *) prom)
- PreANSI(char *prom)
- {
- /* reads a single integer */
- Pint i;
- ptkboolean ok;
- char str[255];
-
- readstring(str, prom);
- i = 0;
- i = atoi(str);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%d ", i);
- return i;
- } /* readinteger */
-
- /*--------------------------------------------------------------------------*/
-
- static Pint readposinteger(C(char *) prom)
- PreANSI(char *prom)
- {
- /* reads a single integer */
- Pint i;
- ptkboolean ok;
- char str[255];
-
- readstring(str, prom);
- i = 0;
- i = atoi(str);
- while (i < 0)
- {
- fprintf(stderr, "Phinter: input integer must be >= 0\n");
- readstring(str, prom);
- i = 0;
- i = atoi(str);
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%d ", i);
- return i;
- } /* readposinteger */
-
- /*--------------------------------------------------------------------------*/
-
- static Pint readintvalue(C(char *) prom, C(ptkehashtable) htable)
- PreANSI(char *prom)
- PreANSI(ptkehashtable htable)
- {
- /* reads a single integer */
- Pint i;
- ptkboolean ok;
- char str[80];
- Pint wi;
- Pint ch;
- ptkboolean finished, instring;
-
- /* check for required hashtable */
- switch (htable)
- {
- case PTKESTRUCTID:
- if (!ptk_hashtableused("structureid"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
-
- case PTKELABELVAL:
- if (!ptk_hashtableused("label"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
-
- case PTKEPICKID:
- if (!ptk_hashtableused("pickid"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
-
- case PTKEVIEWIND:
- if (!ptk_hashtableused("viewindex"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
-
- case PTKECOLOURIND:
- if (!ptk_hashtableused("colourindex"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
-
- case PTKENAME:
- if (!ptk_hashtableused("name"))
- {
- i = readinteger(prom);
- return i;
- }
- break;
- }
-
- instring = FALSE;
- if (fileswitch)
- {
- set_i_prompt(prom);
- wi = 0;
- finished = FALSE;
- ch = getc(inputscript);
- while ((ch == ' ' || ch == '\n') && (ch != EOF))
- ch = getc(inputscript);
- if (ch == EOF)
- {
- str[wi++] = EOF;
- finished = TRUE;
- }
- if (ch == '"')
- {
- instring = TRUE;
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if ((ch == '"') && (wi > 1))
- finished = TRUE;
- else
- ch = getc(inputscript);
- }
- str[wi] = '\0';
- }
- else
- {
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if (ch == '\0')
- finished = TRUE;
- else
- if (ch == '\n' || ch == ' ')
- {
- finished = TRUE;
- wi--;
- }
- else
- ch = getc(inputscript);
- }
- str[wi] = '\0';
- }
- checkabort(str);
- }
- else
- {
- char prompt[80];
-
- sprintf(prompt, "%s> ", prom);
- ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
- checkabort(str);
- if (strchr(str, '\"') != NULL)
- instring = TRUE;
- }
- if (instring)
- {
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s ", str);
- stripstr(str, '"');
- switch (htable)
- {
- case PTKESTRUCTID:
- return ptk_stringtoint("structureid", str);
- break;
-
- case PTKELABELVAL:
- return ptk_stringtoint("label", str);
- break;
-
- case PTKEPICKID:
- return ptk_stringtoint("pickid", str);
- break;
-
- case PTKEVIEWIND:
- return ptk_stringtoint("viewindex", str);
- break;
-
- case PTKECOLOURIND:
- return ptk_stringtoint("colourindex", str);
- break;
-
- case PTKENAME:
- return ptk_stringtoint("name", str);
- break;
- }
- }
- else
- {
- i = atoi(str);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%d ", i);
- return i;
- }
- } /* readintvalue */
-
- /*--------------------------------------------------------------------------*/
-
- static Pint readposintvalue(C(char *) prom, C(ptkehashtable) htable)
- PreANSI(char *prom)
- PreANSI(ptkehashtable htable)
- {
- /* reads a single integer */
- Pint i;
- ptkboolean ok;
- char str[80];
- Pint wi;
- Pint ch;
- ptkboolean finished, instring;
-
- /* check for required hashtable */
- switch (htable)
- {
- case PTKESTRUCTID:
- if (!ptk_hashtableused("structureid"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
-
- case PTKELABELVAL:
- if (!ptk_hashtableused("label"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
-
- case PTKEPICKID:
- if (!ptk_hashtableused("pickid"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
-
- case PTKEVIEWIND:
- if (!ptk_hashtableused("viewindex"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
-
- case PTKECOLOURIND:
- if (!ptk_hashtableused("colourindex"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
-
- case PTKENAME:
- if (!ptk_hashtableused("name"))
- {
- i = readposinteger(prom);
- return i;
- }
- break;
- }
-
- instring = FALSE;
- if (fileswitch)
- {
- set_i_prompt(prom);
- wi = 0;
- finished = FALSE;
- ch = getc(inputscript);
- while ((ch == ' ' || ch == '\n') && (ch != EOF))
- ch = getc(inputscript);
- if (ch == EOF)
- {
- str[wi++] = EOF;
- finished = TRUE;
- }
- if (ch == '"')
- {
- instring = TRUE;
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if ((ch == '"') && (wi > 1))
- finished = TRUE;
- else
- ch = getc(inputscript);
- }
- str[wi] = '\0';
- }
- else
- {
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if (ch == '\0')
- finished = TRUE;
- else
- if (ch == '\n' || ch == ' ')
- {
- finished = TRUE;
- wi--;
- }
- else
- ch = getc(inputscript);
- }
- str[wi] = '\0';
- }
- checkabort(str);
- }
- else
- {
- char prompt[80];
-
- sprintf(prompt, "%s> ", prom);
- ptk_readstring(phinws, "", prompt, &phinecho, 80, str, &wi);
- checkabort(str);
- if (strchr(str, '\"') != NULL)
- instring = TRUE;
- }
- if (instring)
- {
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s ", str);
- stripstr(str, '"');
- switch (htable)
- {
- case PTKESTRUCTID:
- return ptk_stringtoint("structureid", str);
- break;
-
- case PTKELABELVAL:
- return ptk_stringtoint("label", str);
- break;
-
- case PTKEPICKID:
- return ptk_stringtoint("pickid", str);
- break;
-
- case PTKEVIEWIND:
- return ptk_stringtoint("viewindex", str);
- break;
-
- case PTKECOLOURIND:
- return ptk_stringtoint("colourindex", str);
- break;
-
- case PTKENAME:
- return ptk_stringtoint("name", str);
- break;
- }
- }
- else
- {
- i = atoi(str);
- while (i < 0)
- {
- fprintf(stderr, "Phinter: input integer must be >= 0\n");
- i = readposintvalue(prom, htable);
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%d ", i);
- return i;
- }
- } /* readposintvalue */
-
- /*--------------------------------------------------------------------------*/
-
- static Pfloat readreal(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- /* reads a single real */
- Pfloat r;
- ptkboolean ok;
- char str[255];
-
- readstring(str, prom);
- r = 0.0;
- sscanf(str, "%f", &r);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%f ", r);
- return r;
- } /* readreal */
-
- /*--------------------------------------------------------------------------*/
-
- static void readmatrix(C(Pmatrix) m, C(char *) prom)
- PreANSI(Pmatrix m)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, j;
- char prompt[80], str[80];
-
- i = j = 0;
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- readstring(str, prompt);
- if (strncmp(str, "VMM", 3) == 0)
- {
- memcpy(m, vmm, sizeof(Pmatrix));
- if (writingscript)
- writematrix(PTKEOUTPUT, m);
- }
- else
- if (strncmp(str, "VOM", 3) == 0)
- {
- memcpy(m, vom, sizeof(Pmatrix));
- if (writingscript)
- writematrix(PTKEOUTPUT, m);
- }
- else
- if (strncmp(str, "TM", 3) == 0)
- {
- memcpy(m, tm, sizeof(Pmatrix));
- if (writingscript)
- writematrix(PTKEOUTPUT, m);
- }
- else
- {
- m[i][j] = 0.0;
- sscanf(str, "%f", &m[i][j]);
- for (j = 1; j <= 2; j++)
- {
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- m[i][j] = readreal(prompt);
- }
- for (i = 1; i <= 2; i++)
- {
- for (j = 0; j <= 2; j++)
- {
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- m[i][j] = readreal(prompt);
- }
-
- }
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* readmatrix */
-
- /*--------------------------------------------------------------------------*/
-
- static void readmatrix3(C(Pmatrix3) m, C(char *) prom)
- PreANSI(Pmatrix3 m)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, j;
- char prompt[80], str[80];
-
- i = j = 0;
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- readstring(str, prompt);
- if (strncmp(str, "VMM3", 3) == 0)
- {
- memcpy(m, vmm3, sizeof(Pmatrix3));
- if (writingscript)
- writematrix3(PTKEOUTPUT, m);
- }
- else
- if (strncmp(str, "VOM3", 3) == 0)
- {
- memcpy(m, vom3, sizeof(Pmatrix3));
- if (writingscript)
- writematrix3(PTKEOUTPUT, m);
- }
- else
- if (strncmp(str, "TM3", 3) == 0)
- {
- memcpy(m, tm3, sizeof(Pmatrix3));
- if (writingscript)
- writematrix3(PTKEOUTPUT, m);
- }
- else
- {
- m[i][j] = 0.0;
- sscanf(str, "%f", &m[i][j]);
- for (j = 1; j <= 3; j++)
- {
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- m[i][j] = readreal(prompt);
- }
- for (i = 1; i <= 3; i++)
- {
- for (j = 0; j <= 3; j++)
- {
- sprintf(prompt, "%s, element [%d][%d] ? ", prom, i, j);
- m[i][j] = readreal(prompt);
- }
-
- }
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* readmatrix3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readintlst(C(Pint_list *) nlist, C(char *) prom,
- C(ptkehashtable) htable)
- PreANSI(Pint_list *nlist)
- PreANSI(char *prom)
- PreANSI(ptkehashtable htable)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i;
- char prompt[255];
-
- sprintf(prompt, "%s, number ? ", prom);
- nlist->num_ints = readposinteger(prompt);
- prompt[0] = '\0';
- nlist->ints = (Pint *)calloc(nlist->num_ints, sizeof(Pint));
- for (i = 0; i < nlist->num_ints; i++)
- {
- sprintf(prompt, "%s, integer [%d]? ", prom, i);
- nlist->ints[i] = readintvalue(prompt, htable);
- if (writingscript) /* newline between each name */
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readintlst */
-
- /*--------------------------------------------------------------------------*/
-
- static void readfloatlist(C(Pfloat_list *) nlist, C(char *) prom)
- PreANSI(Pfloat_list *nlist)
- PreANSI(char *prom)
- {
- Pint i;
- char prompt[255];
-
- sprintf(prompt, "%s, number ? ", prom);
- nlist->num_floats = readposinteger(prompt);
- prompt[0] = '\0';
- nlist->floats = (Pfloat *)calloc(nlist->num_floats, sizeof(Pfloat));
- for (i = 0; i < nlist->num_floats; i++)
- {
- sprintf(prompt, "%s, float [%d]? ", prom, i);
- nlist->floats[i] = readreal(prompt);
- if (writingscript) /* newline between each name */
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readfloatlist */
-
- /*--------------------------------------------------------------------------*/
-
- static void readintarray(C(Pint) numints, C(Pint *) nlist, C(char *) prom,
- C(ptkehashtable) htable)
- PreANSI(Pint numints)
- PreANSI(Pint *nlist)
- PreANSI(char *prom)
- PreANSI(ptkehashtable htable)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i;
- char prompt[255];
-
- for (i = 0; i < numints; i++)
- {
- sprintf(prompt, "%s [%d] ? ", prom, i);
- nlist[i] = readintvalue(prompt, htable);
- if (writingscript) /* newline between each name */
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readintarray */
-
- /*--------------------------------------------------------------------------*/
-
- static Ppoint readpoint(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Ppoint t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, x ? ", prom);
- t.x = readreal(pointprom);
- sprintf(pointprom, "%s, y ? ", prom);
- t.y = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readpoint */
-
- /*--------------------------------------------------------------------------*/
-
- static Pvec readvector(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pvec t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, x ? ", prom);
- t.delta_x = readreal(pointprom);
- sprintf(pointprom, "%s, y ? ", prom);
- t.delta_y = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readvector */
-
- /*--------------------------------------------------------------------------*/
-
- static Plimit readlimit(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Plimit t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, xmin ? ", prom);
- t.x_min = readreal(pointprom);
- sprintf(pointprom, "%s, xmax ? ", prom);
- t.x_max = readreal(pointprom);
- sprintf(pointprom, "%s, ymin ? ", prom);
- t.y_min = readreal(pointprom);
- sprintf(pointprom, "%s, ymax ? ", prom);
- t.y_max = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readlimit */
-
- /*--------------------------------------------------------------------------*/
-
- static Ppoint3 readpoint3(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Ppoint3 t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, x ? ", prom);
- t.x = readreal(pointprom);
- sprintf(pointprom, "%s, y ? ", prom);
- t.y = readreal(pointprom);
- sprintf(pointprom, "%s, z ? ", prom);
- t.z = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readpoint3 */
-
- /*--------------------------------------------------------------------------*/
-
- static Pvec3 readvector3(C(char *) prom)
- PreANSI(char *prom)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pvec3 t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, x ? ", prom);
- t.delta_x = readreal(pointprom);
- sprintf(pointprom, "%s, y ? ", prom);
- t.delta_y = readreal(pointprom);
- sprintf(pointprom, "%s, z ? ", prom);
- t.delta_z = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readvector3 */
-
- /*--------------------------------------------------------------------------*/
-
- static Plimit3 readlimit3(C(char *) prom)
- PreANSI(char *prom)
- {
- Plimit3 t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, xmin ? ", prom);
- t.x_min = readreal(pointprom);
- sprintf(pointprom, "%s, xmax ? ", prom);
- t.x_max = readreal(pointprom);
- sprintf(pointprom, "%s, ymin ? ", prom);
- t.y_min = readreal(pointprom);
- sprintf(pointprom, "%s, ymax ? ", prom);
- t.y_max = readreal(pointprom);
- sprintf(pointprom, "%s, zmin ? ", prom);
- t.z_min = readreal(pointprom);
- sprintf(pointprom, "%s, zmax ? ", prom);
- t.z_max = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readlimit3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpickpath(C(Ppick_path *) path, C(char *) desc)
- PreANSI(Ppick_path *path)
- PreANSI(char *desc)
- {
- Pint i;
- char str[255];
-
- sprintf(str, "%s, depth", desc);
- path->depth = readposinteger(str);
- path->path_list = (Ppick_path_elem *)calloc(path->depth,
- sizeof(Ppick_path_elem));
- for (i = 0; i < path->depth; i++)
- {
- sprintf(str, "%s, structure identifier [%d]", desc, i);
- path->path_list[i].struct_id = readinteger(str);
- sprintf(str, "%s, pick identifier [%d]", desc, i);
- path->path_list[i].pick_id = readinteger(str);
- sprintf(str, "%s, element number [%d]", desc, i);
- path->path_list[i].elem_pos = readinteger(str);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointlst(C(Ppoint_list *) plist)
- PreANSI(Ppoint_list *plist)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, n;
- char prom[30];
-
- plist->num_points = readposinteger("number of points ? ");
- plist->points = (Ppoint *)calloc(plist->num_points, sizeof(Ppoint));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "Point %d", i+1);
- plist->points[i] = readpoint(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readpointlst3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointlst3(C(Ppoint_list3 *) plist)
- PreANSI(Ppoint_list3 *plist)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, n;
- char prom[30];
-
- plist->num_points = readposinteger("number of points ? ");
- plist->points = (Ppoint3 *)calloc(plist->num_points, sizeof(Ppoint3));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "Point %d", i+1);
- plist->points[i] = readpoint3(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readpointlst3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointarray(C(Pint) numpts, C(Ppoint *) plist)
- PreANSI(Pint numpts)
- PreANSI(Ppoint *plist)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, n;
- char prom[30];
-
- for (i = 0; i < numpts; i++)
- {
- sprintf(prom, "Point %d", i+1);
- plist[i] = readpoint(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readpointarray */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpoint3array(C(Pint) numpts, C(Ppoint3 *) plist)
- PreANSI(Pint numpts)
- PreANSI(Ppoint3 *plist)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, n;
- char prom[30];
-
- for (i = 0; i < numpts; i++)
- {
- sprintf(prom, "Point %d", i+1);
- plist[i] = readpoint3(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- } /* readpoint3array */
-
- /*--------------------------------------------------------------------------*/
-
- static Pcolr_rep readcolour()
- /*
- ** read a colour representation depending on the current
- ** colour model.
- */
- {
- Pcolr_rep t;
-
- switch (colourmodel)
- {
- case PMODEL_RGB:
- t.rgb.red = readreal("red ? ");
- t.rgb.green = readreal("green ? ");
- t.rgb.blue = readreal("blue ? ");
- break;
-
- case PMODEL_CIELUV:
- t.cieluv.cieluv_x = readreal("x coefficient ? ");
- t.cieluv.cieluv_y = readreal("y coefficient ? ");
- t.cieluv.cieluv_y_lum = readreal("y luminance ? ");
- break;
-
- case PMODEL_HSV:
- t.hsv.hue = readreal("hue ? ");
- t.hsv.satur = readreal("saturation ? ");
- t.hsv.value = readreal("value ? ");
- break;
-
- case PMODEL_HLS:
- t.hls.hue = readreal("hue ? ");
- t.hls.lightness = readreal("lightness ? ");
- t.hls.satur = readreal("saturation ? ");
- break;
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readcolour */
-
- /*--------------------------------------------------------------------------*/
-
- static void readexecreflst(C(Pelem_ref_list *) reflist, C(char *) prom)
- PreANSI(Pelem_ref_list *reflist)
- PreANSI(char *prom)
- {
- Pint i, num;
- char prompt[255];
-
- sprintf(prompt, "%s, number ? ", prom);
- reflist->num_elem_refs = readposinteger(prompt);
- reflist->elem_refs = (Pelem_ref *)calloc(reflist->num_elem_refs,
- sizeof(Pelem_ref));
- for (i = 0; i < reflist->num_elem_refs; i++)
- {
- sprintf(prompt, "%s, execute reference [%d], structure identifier ? ",
- prom, i);
- reflist->elem_refs[i].struct_id = readinteger(prompt);
- sprintf(prompt, "%s, execute reference [%d], element number ? ",
- prom, i);
- reflist->elem_refs[i].elem_pos = readinteger(prompt);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- #ifndef HP
- static void readfilterlst(C(Pfilter_list *) filtlist, C(char *) prom)
- PreANSI(Pfilter_list *filtlist)
- PreANSI(char *prom)
- {
- Pint i, num;
- char prompt[255];
-
- sprintf(prompt, "%s, number of filters ? ", prom);
- filtlist->num_filters = readposinteger(prompt);
- filtlist->filters = (Pfilter *)calloc(filtlist->num_filters,
- sizeof(Pfilter));
- for (i = 0; i < filtlist->num_filters; i++)
- {
- sprintf(prompt, "%s, filter [%d], inclusion set, number ? ", prom, i);
- filtlist->filters[i].incl_set.num_ints = num = readposinteger(prompt);
- filtlist->filters[i].incl_set.ints = (Pint *)calloc(num,
- sizeof(Pint));
- sprintf(prompt, "%s, filter [%d], inclusion set", prom, i);
- readintarray(num, filtlist->filters[i].incl_set.ints, prompt,
- PTKENAME);
- sprintf(prompt, "%s, filter [%d], exclusion set, number ? ", prom, i);
- filtlist->filters[i].excl_set.num_ints = num = readposinteger(prompt);
- filtlist->filters[i].excl_set.ints = (Pint *)calloc(num, sizeof(Pint));
- sprintf(prompt, "%s, filter [%d], exclusion set", prom, i);
- readintarray(num, filtlist->filters[i].excl_set.ints, prompt,
- PTKENAME);
- }
- }
- #endif
-
- /*--------------------------------------------------------------------------*/
-
- static ptkboolean inlist(C(char **) strlist, C(Pint) lenlist, C(char *) str,
- C(Pint *) ind)
- PreANSI(char **strlist)
- PreANSI(Pint lenlist)
- PreANSI(char *str)
- PreANSI(Pint *ind)
- /*
- ** description: searches list of strings for given string.
- ** input params: strlist - pointer to string list.
- ** lenlist - length of string list.
- ** str - string to search.
- ** output params: none.
- ** return value: index of found string, -1 if not found.
- ** special notes:
- */
- {
- ptkboolean found;
- Pint i;
-
- found = FALSE;
- *ind = -1;
- i = 0;
- while ((found == FALSE) && (i < lenlist))
- {
- if (strcmp(strlist[i], str) == 0)
- found = TRUE;
- else
- i++;
- }
- if (found)
- *ind = i;
- return found;
- } /* inlist */
-
- /*--------------------------------------------------------------------------*/
-
- static ptkboolean substrinlist(C(char **) strlist, C(Pint) lenlist,
- C(char *) str, C(Pint *) ind)
- PreANSI(char **strlist)
- PreANSI(Pint lenlist)
- PreANSI(char *str)
- PreANSI(Pint *ind)
- /*
- ** description: searches list of strings for given string.
- ** input params: strlist - pointer to string list.
- ** lenlist - length of string list.
- ** str - string to search.
- ** output params: none.
- ** return value: index of found string, -1 if not found.
- ** special notes:
- */
- {
- ptkboolean found;
- Pint i;
-
- found = FALSE;
- *ind = -1;
- i = 0;
- while ((found == FALSE) && (i < lenlist))
- {
- if (strncmp(strlist[i], str, strlen(str)) == 0)
- found = TRUE;
- else
- i++;
- }
- if (found)
- *ind = i;
- return found;
- } /* inlist */
-
- /*--------------------------------------------------------------------------*/
-
- static Pint getphigsenum(C(ptkephigsenum) phigsenum, C(char *) enumstring)
- PreANSI(ptkephigsenum phigsenum)
- PreANSI(char *enumstring)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint enumval;
- ptkboolean found;
-
- switch (phigsenum)
- {
- case PTKEWSDEP:
- found = inlist(Pws_dep_indnames, 2, enumstring, &enumval);
- break;
-
- case PTKESYSTEMSTATE:
- found = inlist(Psys_stnames, 2, enumstring, &enumval);
- break;
-
- case PTKEWSSTATE:
- found = inlist(Pws_stnames, 2, enumstring, &enumval);
- break;
-
- case PTKESTRUCTSTATE:
- found = inlist(Pstruct_stnames, 2, enumstring, &enumval);
- break;
-
- case PTKESTRUCTSTATUS:
- found = inlist(Pstruct_statusnames, 3, enumstring, &enumval);
- break;
-
- case PTKEARCHIVESTATE:
- found = inlist(Par_stnames, 2, enumstring, &enumval);
- break;
-
- case PTKEWSCLASS:
- found = inlist(Pws_classnames, 3, enumstring, &enumval);
- break;
-
- case PTKEWSCAT:
- found = inlist(Pws_catnames, 5, enumstring, &enumval);
- break;
-
- case PTKECONTROL:
- found = inlist(Pctrl_flagnames, 2, enumstring, &enumval);
- break;
-
- case PTKEREGEN:
- found = inlist(Pregen_flagnames, 2, enumstring, &enumval);
- break;
-
- case PTKEDEFMODE:
- found = inlist(Pdefer_modenames, 5, enumstring, &enumval);
- break;
-
- case PTKEMOD:
- found = inlist(Pmodnames, 3, enumstring, &enumval);
- break;
-
- case PTKESIMULTEV:
- found = inlist(Psimult_eventsnames, 2, enumstring, &enumval);
- break;
-
- case PTKESTRUCTNETSRC:
- found = inlist(Pstruct_net_sourcenames, 2, enumstring, &enumval);
- break;
-
- case PTKEDSPSURF:
- found = inlist(Pdisp_surfnames, 2, enumstring, &enumval);
- break;
-
- case PTKEVISUALREP:
- found = inlist(Pvisual_stnames, 3, enumstring, &enumval);
- break;
-
- case PTKETXPREC:
- found = inlist(Ptext_precnames, 3, enumstring, &enumval);
- break;
-
- case PTKETXPATH:
- found = inlist(Ptext_pathnames, 4, enumstring, &enumval);
- break;
-
- case PTKETXHOR:
- found = inlist(Phor_alignnames, 4, enumstring, &enumval);
- break;
-
- case PTKETXVER:
- found = inlist(Pvert_alignnames, 5, enumstring, &enumval);
- break;
-
- case PTKEINTERSTYLE:
- found = inlist(Pint_stylenames, 5, enumstring, &enumval);
- break;
-
- case PTKEEDGEF:
- found = inlist(Pedge_flagnames, 2, enumstring, &enumval);
- break;
-
- case PTKEATTRID:
- found = inlist(Paspectnames, 18, enumstring, &enumval);
- break;
-
- case PTKEASF:
- found = inlist(Pasfnames, 2, enumstring, &enumval);
- break;
-
- case PTKECOAVAIL:
- found = inlist(Pcolr_availnames, 2, enumstring, &enumval);
- break;
-
- case PTKECOMPTYPE:
- found = inlist(Pcompose_typenames, 3, enumstring, &enumval);
- break;
-
- case PTKEPROJTYPE:
- found = inlist(Pproj_typenames, 2, enumstring, &enumval);
- break;
-
- case PTKECLIP:
- found = inlist(Pclip_indnames, 2, enumstring, &enumval);
- break;
-
- case PTKEVPRI:
- found = inlist(Pprinames, 2, enumstring, &enumval);
- break;
-
- case PTKECONFRES:
- found = inlist(Pconf_resnames, 3, enumstring, &enumval);
- break;
-
- case PTKEPFCF:
- found = inlist(Ppfcfnames, 3, enumstring, &enumval);
- break;
-
- case PTKEPATHORDER:
- found = inlist(Ppath_ordernames, 2, enumstring, &enumval);
- break;
-
- case PTKEIMODE:
- found = inlist(Pop_modenames, 3, enumstring, &enumval);
- break;
-
- case PTKEESW:
- found = inlist(Pechonames, 2, enumstring, &enumval);
- break;
-
- case PTKEISTATUS:
- found = inlist(Pistatusnames, 3, enumstring, &enumval);
- break;
-
- case PTKEOPENSTRUCTSTATUS:
- found = inlist(Popen_struct_statusnames, 2, enumstring, &enumval);
- break;
-
- case PTKEICLASS:
- found = inlist(Pin_classnames, 7, enumstring, &enumval);
- break;
-
- case PTKEPRF:
- found = inlist(Pprompt_switchnames, 2, enumstring, &enumval);
- break;
-
- case PTKEINQTYPE:
- found = inlist(Pinq_typenames, 2, enumstring, &enumval);
- break;
-
- case PTKEUPDATEST:
- found = inlist(Pupd_stnames, 2, enumstring, &enumval);
- break;
-
- case PTKEDEVUNITS:
- found = inlist(Pdc_unitsnames, 2, enumstring, &enumval);
- break;
-
- case PTKEMODTYPE:
- found = inlist(Pdyn_modnames, 3, enumstring, &enumval);
- break;
-
- case PTKEATTRS:
- found = inlist(Pattrsnames, 5, enumstring, &enumval);
- break;
-
- case PTKEELTYPE:
- found = inlist(Pelem_typenames, 71, enumstring, &enumval);
- break;
-
- case PTKEEDITMODE:
- found = inlist(Pedit_modenames, 2, enumstring, &enumval);
- break;
-
- case PTKEREFF:
- found = inlist(Pref_flagnames, 2, enumstring, &enumval);
- break;
-
- case PTKEERRORMODE:
- found = inlist(Perr_modenames, 2, enumstring, &enumval);
- break;
-
- case PTKESRCHDIR:
- found = inlist(Psearch_dirnames, 2, enumstring, &enumval);
- break;
-
- case PTKESRCHSTATUS:
- found = inlist(Psearch_statusnames, 2, enumstring, &enumval);
- break;
-
- case PTKESRCHELTYPE:
- found = inlist(Pelem_typenames, 71, enumstring, &enumval);
- break;
-
- #ifdef SUN
- case PTKEBASENAME:
- found = inlist(Pbasenames, 4, enumstring, &enumval);
- break;
-
- case PTKEWSTYPEATTR:
- found = inlist(Pwsattrnames, 41, enumstring, &enumval);
- break;
-
- case PTKEDBLBUFF:
- found = inlist(Pdblbuffnames, 3, enumstring, &enumval);
- break;
-
- case PTKECURSORTYPE:
- found = inlist(Pcursortypenames, 4, enumstring, &enumval);
- if (found == 2)
- found = 3;
- else
- if (found == 3)
- found = 12;
- break;
-
- case PTKEACCUSAGE:
- found = inlist(Paccusagenames, 11, enumstring, &enumval);
- break;
-
- case PTKECOLOURMODE:
- found = inlist(Pcolourmodenames, 2, enumstring, &enumval);
- break;
-
- case PTKECGMENCODING:
- found = inlist(Pcgmencodingnames, 3, enumstring, &enumval);
- break;
-
- case PTKECGMCONFORMANCE:
- found = inlist(Pcgmconformancenames, 3, enumstring, &enumval);
- break;
-
- case PTKECGMVDCPRECISION:
- found = inlist(Pcgmvdcprecisionnames, 2, enumstring, &enumval);
- break;
-
- case PTKEBGCLEAR:
- found = inlist(Pbgclearnames, 2, enumstring, &enumval);
- break;
-
- case PTKEUSEDECOMP:
- found = inlist(Pdcmpnames, 2, enumstring, &enumval);
- break;
-
- case PTKEDCMODEL:
- found = inlist(Pdcmodelnames, 2, enumstring, &enumval);
- break;
-
- case PTKESIMULATEPICK:
- found = inlist(Psimulatepicknames, 2, enumstring, &enumval);
- break;
- #endif
- #ifdef PEXSI
- case PTKEBASENAME:
- found = inlist(Pbasenames, 4, enumstring, &enumval);
- break;
-
- case PTKEWSTYPEATTR:
- found = inlist(Pwsattrnames, 41, enumstring, &enumval);
- break;
-
- case PTKEDBLBUFF:
- found = inlist(Pdblbuffnames, 3, enumstring, &enumval);
- break;
-
- case PTKEBGCLEAR:
- found = inlist(Pbgclearnames, 2, enumstring, &enumval);
- break;
-
- case PTKEDCMODEL:
- found = inlist(Pdcmodelnames, 2, enumstring, &enumval);
- break;
- #endif
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- case PTKEDCUEMODE:
- found = inlist(Pdcuemodenames, 2, enumstring, &enumval);
- break;
-
- case PTKERATIONAL:
- found = inlist(Prationalnames, 2, enumstring, &enumval);
- break;
-
- case PTKECULLMODE:
- found = inlist(Pcullmodenames, 3, enumstring, &enumval);
- break;
-
- case PTKEDISTINGMODE:
- found = inlist(Pdistingmodenames, 2, enumstring, &enumval);
- break;
-
- case PTKECURVEPLACE:
- found = inlist(Pcurveplacenames, 2, enumstring, &enumval);
- break;
- #endif
- }
- return enumval;
- }
-
- /*--------------------------------------------------------------------------*/
-
- static Pint readphigsenum(C(ptkephigsenum) phigsenum, C(char *) prom)
- PreANSI(ptkephigsenum phigsenum)
- PreANSI(char *prom)
- {
- Pint enumval;
- char enumstring[80];
-
- readstring(enumstring, prom);
- stripstr(enumstring, '"');
- /* make upper case */
- strupper(enumstring);
- enumval = getphigsenum(phigsenum, enumstring);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s ", enumstring);
- return enumval;
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readenumlist(C(Pint) length, C(Pint *) enumlist,
- C(ptkephigsenum) enumtype, C(char *) prom)
- PreANSI(Pint length)
- PreANSI(Pint *enumlist)
- PreANSI(ptkephigsenum enumtype)
- PreANSI(char *prom)
- {
- Pint i;
- char prompt[255];
-
- for (i = 0; i < length; i++)
- {
- sprintf(prompt, "%s [%d] ", prom, i);
- enumlist[i] = readphigsenum(enumtype, prompt);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readwstype(C(Pint *) wstype)
- PreANSI(Pint *wstype)
- {
- char str[80];
-
- readstring(str, "workstation type");
- stripstr(str, '"');
- strupper(str);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s ", str);
- if ((strncmp(str, "WST", 3) == 0) || (strncmp(str, "WS", 2) == 0))
- *wstype = wst;
- else
- #ifdef SUN
- {
- Phigs_base_name base;
-
- base = getphigsenum(PTKEBASENAME, str);
- switch (base)
- {
- case PHIGS_X_TOOL:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- break;
-
- case PHIGS_X_DRAWABLE:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable, 0);
- break;
-
- case PHIGS_CGM_OUT:
- *wstype = phigs_ws_type_create(phigs_ws_type_cgm_out, 0);
- break;
-
- case PHIGS_X_DRAWABLE_REGION:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable_region, 0);
- break;
-
- default:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- break;
- }
- }
- #endif
- #ifdef PEXSI
- {
- Phigs_base_name base;
-
- base = getphigsenum(PTKEBASENAME, str);
- switch (base)
- {
- case PHIGS_X_TOOL:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, NULL);
- break;
-
- case PHIGS_X_DRAWABLE:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_drawable, NULL);
- break;
-
- default:
- *wstype = phigs_ws_type_create(phigs_ws_type_x_tool, NULL);
- break;
- }
- }
- #endif
- #ifdef VMS
- {
- Pint wsint;
-
- wsint = atoi(str);
- *wstype = wsint;
- }
- #endif
- #ifdef HP
- {
- Pint wsint;
-
- wsint = atoi(str);
- *wstype = wsint;
- }
- #endif
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readlnbundl(C(Pline_bundle *) bundl)
- PreANSI(Pline_bundle *bundl)
- {
- bundl->type = readinteger("linetype");
- bundl->width = readreal("linewidth scale factor");
- bundl->colr_ind = readposintvalue("line colour index", PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readmkbundl(C(Pmarker_bundle *) bundl)
- PreANSI(Pmarker_bundle *bundl)
- {
- bundl->type = readinteger("marker type");
- bundl->size = readreal("marker size scale factor");
- bundl->colr_ind = readposintvalue("marker colour index", PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readtxbundl(C(Ptext_bundle *) bundl)
- PreANSI(Ptext_bundle *bundl)
- {
- bundl->font = readinteger("text font");
- bundl->prec = readphigsenum(PTKETXPREC, "text precision");
- bundl->char_expan = readreal("character expansion factor");
- bundl->char_space = readreal("character spacing");
- bundl->colr_ind = readposintvalue("text colour index", PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readinterbundl(C(Pint_bundle *) bundl)
- PreANSI(Pint_bundle *bundl)
- {
- bundl->style = readphigsenum(PTKEINTERSTYLE, "interior style");
- bundl->style_ind = readinteger("interior style index");
- bundl->colr_ind = readposintvalue("interior colour index", PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readedgebundl(C(Pedge_bundle *) bundl)
- PreANSI(Pedge_bundle *bundl)
- {
- bundl->flag = readphigsenum(PTKEEDGEF, "edge flag");
- bundl->type = readinteger("edgetype");
- bundl->width = readreal("edgewidth scale factor");
- bundl->colr_ind = readposintvalue("edge colour index", PTKECOLOURIND);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readlnattr(C(Pline_attrs *) attr)
- PreANSI(Pline_attrs *attr)
- {
- attr->type_asf = readphigsenum(PTKEASF, "linetype asf");
- attr->width_asf = readphigsenum(PTKEASF, "line width asf");
- attr->colr_ind_asf = readphigsenum(PTKEASF, "line colour asf");
- attr->ind = readposinteger("line index");
- readlnbundl(&attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readinterattr(C(Pint_attrs *) attr)
- PreANSI(Pint_attrs *attr)
- {
- attr->style_asf = readphigsenum(PTKEASF, "interior asf");
- attr->style_ind_asf = readphigsenum(PTKEASF, "interior style asf");
- attr->colr_ind_asf = readphigsenum(PTKEASF, "interior colour asf");
- attr->ind = readposinteger("interior index");
- readinterbundl(&attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readedgeattr(C(Pedge_attrs *) attr)
- PreANSI(Pedge_attrs *attr)
- {
- attr->flag_asf = readphigsenum(PTKEASF, "edge flag asf");
- attr->width_asf = readphigsenum(PTKEASF, "edge width asf");
- attr->colr_ind_asf = readphigsenum(PTKEASF, "edge colour asf");
- attr->ind = readposinteger("edge index");
- readedgebundl(&attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readmkattr(C(Pmarker_attrs *) attr)
- PreANSI(Pmarker_attrs *attr)
- {
- attr->type_asf = readphigsenum(PTKEASF, "marker type asf");
- attr->size_asf = readphigsenum(PTKEASF, "marker size asf");
- attr->colr_ind_asf = readphigsenum(PTKEASF, "marker colour asf");
- attr->ind = readposinteger("marker index");
- readmkbundl(&attr->bundle);
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void readchoicerec(C(Pint) device, C(Pint) pet, C(Pchoice_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pchoice_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- switch (pet)
- {
- case 1:
- break;
-
- case 3:
- {
- Pint i, len;
- char **chstrings;
-
- rec->pets.pet_r3.num_strings =
- readposinteger("number of choice strings ? ");
- chstrings = (char **)calloc(rec->pets.pet_r3.num_strings,
- sizeof(char *));
- rec->pets.pet_r3.strings = chstrings;
- for (i = 0; i < rec->pets.pet_r3.num_strings; i++)
- {
- len = readposinteger("choice string length ? ");
- chstrings[i] = (char *)calloc(len, sizeof(char));
- readquote(chstrings[i], "choice string ? ");
- }
- }
- break;
- }
- break;
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- break;
-
- default: break;
- }
- #endif
- } /* readchoicerec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readchoicerec3(C(Pint) device, C(Pint) pet,
- C(Pchoice_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pchoice_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- readchoicerec(device, pet, (Pchoice_data *)rec);
- #endif
- #ifdef HP
- readchoicerec(device, pet, (Pchoice_data *)rec);
- #endif
- } /* readchoicerec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readlocrec(C(Pint) device, C(Pint) pet, C(Ploc_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ploc_data *rec)
- {
- Pint i;
-
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- switch (pet)
- {
- case 1:
- case 2:
- case 3:
- break;
-
- case -2:
- rec->pets.pet_u2.crosshair_colr =
- readposintvalue("crosshair colour index ? ", PTKECOLOURIND);
- break;
-
- case -4:
- readlnbundl(&rec->pets.pet_u4.line_bundle);
- break;
-
- case -5:
- readlnbundl(&rec->pets.pet_u5.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- switch (pet)
- {
- case 1:
- rec->pets.pet_r1.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- break;
-
- case 2:
- rec->pets.pet_r2.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- break;
-
- case 3:
- rec->pets.pet_r3.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- break;
-
- case 4:
- readlnattr(&rec->pets.pet_r4.line_attrs);
- break;
-
- case 5:
- rec->pets.pet_r5.line_fill_ctrl_flag =
- readphigsenum(PTKECONTROL, "polyline/fill area control flag ? ");
- switch (rec->pets.pet_r5.line_fill_ctrl_flag)
- {
- case PFLAG_LINE:
- readlnattr(&rec->pets.pet_r5.attrs.line_attrs);
- break;
-
- case PFLAG_FILL:
- readinterattr(&rec->pets.pet_r5.attrs.int_attrs);
- break;
-
- case PFLAG_FILL_SET:
- readinterattr(&rec->pets.pet_r5.attrs.fill_set.int_attrs);
- readedgeattr(&rec->pets.pet_r5.attrs.fill_set.edge_attrs);
- break;
- }
- break;
-
- case 6:
- rec->pets.pet_r6.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- break;
-
- case -1:
- rec->pets.pet_u1.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u1.rect_height = readreal("rectangle height ? ");
- rec->pets.pet_u1.rect_width = readreal("rectangle width ? ");
- break;
-
- case -2:
- rec->pets.pet_u2.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u2.attach_point = readpoint3("attachment point");
- rec->pets.pet_u2.num_point_lists =
- readposinteger("number of point lists ? ");
- rec->pets.pet_u2.point_lists =
- (Ppoint_list *)calloc(rec->pets.pet_u2.num_point_lists,
- sizeof(Ppoint_list));
- for (i = 0; i < rec->pets.pet_u2.num_point_lists; i++)
- readpointlst3(&rec->pets.pet_u2.point_lists[i]);
- break;
-
- case -3:
- rec->pets.pet_u3.loc_colr_ind =
- readposintvalue("locator colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u3.struct_id =
- readintvalue("structure identifier ? ", PTKESTRUCTID);
- rec->pets.pet_u3.attach_point = readpoint3("attachment point");
- break;
- }
-
- default: break;
- }
- #endif
- } /* readlocrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readlocrec3(C(Pint) device, C(Pint) pet, C(Ploc_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ploc_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- readlocrec(device, pet, (Ploc_data *)rec);
- #endif
- #ifdef HP
- readlocrec(device, pet, (Ploc_data *)rec);
- #endif
- } /* readlocrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpickrec(C(Pint) device, C(Pint) pet, C(Ppick_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ppick_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- switch (pet)
- {
- case 1:
- break;
-
- case 2:
- rec->pets.pet_r2.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_r2.highl_count =
- readinteger("number of times to blink ? ");
- rec->pets.pet_r2.highl_duration =
- readinteger("number of seconds per half blink ? ");
- rec->pets.pet_r2.ap_size = readreal("aperture size ? ");
- break;
-
- case 3:
- rec->pets.pet_r3.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_r3.highl_count =
- readposinteger("number of times to blink ? ");
- rec->pets.pet_r3.highl_duration =
- readposinteger("number of seconds per half blink ? ");
- rec->pets.pet_r3.ap_size = readreal("aperture size ? ");
- break;
-
- case -1:
- rec->pets.pet_u1.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u1.highl_count =
- readposinteger("number of times to blink ? ");
- rec->pets.pet_u1.highl_duration =
- readposinteger("number of seconds per half blink ? ");
- rec->pets.pet_u1.ap_size = readreal("aperture size ? ");
- break;
-
- case -2:
- rec->pets.pet_u2.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u2.highl_count =
- readposinteger("number of times to blink ? ");
- rec->pets.pet_u2.highl_duration =
- readposinteger("number of seconds per half blink ? ");
- rec->pets.pet_u2.ap_size = readreal("aperture size ? ");
- break;
-
- case -3:
- rec->pets.pet_u3.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u3.highl_count =
- readposinteger("number of times to blink ? ");
- rec->pets.pet_u3.highl_duration =
- readposinteger("number of seconds per half blink ? ");
- rec->pets.pet_u3.ap_size = readreal("aperture size ? ");
- break;
-
- case -4:
- rec->pets.pet_u4.highl_colr =
- readposintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_u4.highl_count =
- readposinteger("number of times to blink ? ");
- rec->pets.pet_u4.highl_duration =
- readposinteger("number of seconds per half blink ? ");
- rec->pets.pet_u4.ap_size = readreal("aperture size ? ");
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- switch (pet)
- {
- case 1:
- rec->pets.pet_r1.highl_colr_ind =
- readintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_r1.x_dim = readreal("X dimension of aperture ? ");
- rec->pets.pet_r1.y_dim = readreal("Y dimension of aperture ? ");
- rec->pets.pet_r1.z_dim = readreal("Z dimension of aperture ? ");
- break;
-
- case 2:
- rec->pets.pet_r2.highl_colr_ind =
- readintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_r2.x_dim = readreal("X dimension of aperture ? ");
- rec->pets.pet_r2.y_dim = readreal("Y dimension of aperture ? ");
- rec->pets.pet_r2.z_dim = readreal("Z dimension of aperture ? ");
- break;
-
- case 3:
- rec->pets.pet_r3.highl_colr_ind =
- readintvalue("highlight colour index ? ", PTKECOLOURIND);
- rec->pets.pet_r3.x_dim = readreal("X dimension of aperture ? ");
- rec->pets.pet_r3.y_dim = readreal("Y dimension of aperture ? ");
- rec->pets.pet_r3.z_dim = readreal("Z dimension of aperture ? ");
- break;
- }
-
- default: break;
- }
- #endif
- } /* readpickrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpickrec3(C(Pint) device, C(Pint) pet, C(Ppick_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Ppick_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- readpickrec(device, pet, (Ppick_data *)rec);
- #endif
- #ifdef HP
- readpickrec(device, pet, (Ppick_data *)rec);
- #endif
- } /* readpickrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readstringrec(C(Pint) device, C(Pint) pet, C(Pstring_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstring_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- switch (pet)
- {
- case 1:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial position ? ");
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial position ? ");
- switch (pet)
- {
- case 1:
- rec->pets.pet_r1.text_colr_ind =
- readposintvalue("text colour index ? ", PTKECOLOURIND);
- break;
- }
-
- default: break;
- }
- #endif
- } /* readstringrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readstringrec3(C(Pint) device, C(Pint) pet,
- C(Pstring_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstring_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- readstringrec(device, pet, (Pstring_data *)rec);
- #endif
- #ifdef HP
- readstringrec(device, pet, (Pstring_data *)rec);
- #endif
- } /* readstringrec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readstrokerec(C(Pint) device, C(Pint) pet, C(Pstroke_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstroke_data *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial editing position ? ");
- rec->x_interval = readreal("x interval ? ");
- rec->y_interval = readreal("y interval ? ");
- rec->time_interval = readreal("time interval ? ");
- switch (pet)
- {
- case 1:
- break;
-
- case -3:
- readmkbundl(&rec->pets.pet_u3.marker_bundle);
- break;
-
- case -4:
- readlnbundl(&rec->pets.pet_u4.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial editing position ? ");
- rec->x_interval = readreal("x interval ? ");
- rec->y_interval = readreal("y interval ? ");
- rec->time_interval = readreal("time interval ? ");
- switch (pet)
- {
- case 1:
- readlnattr(&rec->pets.pet_r1.line_attrs);
- break;
-
- case 2:
- break;
-
- case 3:
- readmkattr(&rec->pets.pet_r3.marker_attrs);
- break;
-
- case 4:
- readlnattr(&rec->pets.pet_r4.line_attrs);
- break;
- }
-
- default: break;
- }
- #endif
- } /* readstrokerec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readstrokerec3(C(Pint) device, C(Pint) pet,
- C(Pstroke_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pstroke_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial editing position ? ");
- rec->x_interval = readreal("x interval ? ");
- rec->y_interval = readreal("y interval ? ");
- rec->z_interval = readreal("z interval ? ");
- rec->time_interval = readreal("time interval ? ");
- switch (pet)
- {
- case 1:
- break;
-
- case -3:
- readmkbundl(&rec->pets.pet_u3.marker_bundle);
- break;
-
- case -4:
- readlnbundl(&rec->pets.pet_u4.line_bundle);
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 1:
- case 2:
- rec->in_buf_size = readposinteger("buffer size ? ");
- rec->init_pos = readposinteger("initial editing position ? ");
- rec->x_interval = readreal("x interval ? ");
- rec->y_interval = readreal("y interval ? ");
- rec->z_interval = readreal("z interval ? ");
- rec->time_interval = readreal("time interval ? ");
- switch (pet)
- {
- case 1:
- readlnattr(&rec->pets.pet_r1.line_attrs);
- break;
-
- case 2:
- break;
-
- case 3:
- readmkattr(&rec->pets.pet_r3.marker_attrs);
- break;
-
- case 4:
- readlnattr(&rec->pets.pet_r4.line_attrs);
- break;
- }
-
- default: break;
- }
- #endif
- } /* readstrokerec3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readvalrec(C(Pint) device, C(Pint) pet, C(Pval_data *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pval_data *rec)
- {
- Pint len;
-
- /* Implementation dependent code */
- #ifdef SUN
- switch (device)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- rec->low = readreal("low limit ? ");
- rec->high = readreal("high limit ? ");
- switch (pet)
- {
- case 1:
- break;
-
- case -1:
- rec->pets.pet_u1.label = (char *)malloc(80);
- readstring(rec->pets.pet_u1.label, "label ? ");
- rec->pets.pet_u1.format = (char *)malloc(80);
- readstring(rec->pets.pet_u1.format, "format ? ");
- rec->pets.pet_u1.low_label = (char *)malloc(80);
- readstring(rec->pets.pet_u1.low_label, "low label ? ");
- rec->pets.pet_u1.high_label = (char *)malloc(80);
- readstring(rec->pets.pet_u1.high_label, "high label ? ");
- break;
- }
-
- default: break;
- }
- #endif
- #ifdef HP
- switch (device)
- {
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- rec->low_value = readreal("low limit ? ");
- rec->high_value = readreal("high limit ? ");
- switch (pet)
- {
- case 1:
- rec->pets.pet_r1.slider_colr_ind =
- readposintvalue("slider outline colour index ? ", PTKECOLOURIND);
- break;
- }
-
- default: break;
- }
- #endif
- } /* readvalrec */
-
- /*--------------------------------------------------------------------------*/
-
- static void readvalrec3(C(Pint) device, C(Pint) pet, C(Pval_data3 *) rec)
- PreANSI(Pint device)
- PreANSI(Pint pet)
- PreANSI(Pval_data3 *rec)
- {
- /* Implementation dependent code */
- #ifdef SUN
- readvalrec(device, pet, (Pval_data *)rec);
- #endif
- #ifdef HP
- readvalrec(device, pet, (Pval_data *)rec);
- #endif
- } /* readvalrec3 */
-
- /*--------------------------------------------------------------------------*/
- /*------------------- PHIGS PLUS read functions ----------------------------*/
- /*--------------------------------------------------------------------------*/
-
- #ifdef SUN
- static void readdirectcolour(C(Pint) colrmodel, C(Pcoval *) colour,
- C(char *) prom)
- PreANSI(Pint colrmodel)
- PreANSI(Pcoval *colour)
- PreANSI(char *prom)
- /*
- ** read a direct colour representation.
- */
- {
- char prompt[255];
-
- switch (colrmodel)
- {
- case PMODEL_RGB:
- sprintf(prompt, "%s, red ? ", prom);
- colour->direct.rgb.red = readreal(prompt);
- sprintf(prompt, "%s, green ? ", prom);
- colour->direct.rgb.green = readreal(prompt);
- sprintf(prompt, "%s, blue ? ", prom);
- colour->direct.rgb.blue = readreal(prompt);
- break;
-
- case PMODEL_CIELUV:
- sprintf(prompt, "%s, x coefficient ? ", prom);
- colour->direct.cieluv.cieluv_x = readreal(prompt);
- sprintf(prompt, "%s, y coefficient ? ", prom);
- colour->direct.cieluv.cieluv_y = readreal(prompt);
- sprintf(prompt, "%s, y luminance ? ", prom);
- colour->direct.cieluv.cieluv_y_lum = readreal(prompt);
- break;
-
- case PMODEL_HSV:
- sprintf(prompt, "%s, hue ? ", prom);
- colour->direct.hsv.hue = readreal(prompt);
- sprintf(prompt, "%s, saturation ? ", prom);
- colour->direct.hsv.satur = readreal(prompt);
- sprintf(prompt, "%s, value ? ", prom);
- colour->direct.hsv.value = readreal(prompt);
- break;
-
- case PMODEL_HLS:
- sprintf(prompt, "%s, hue ? ", prom);
- colour->direct.hls.hue = readreal(prompt);
- sprintf(prompt, "%s, lightness ? ", prom);
- colour->direct.hls.lightness = readreal(prompt);
- sprintf(prompt, "%s, saturation ? ", prom);
- colour->direct.hls.satur = readreal(prompt);
- break;
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* readdirectcolour */
-
- /*--------------------------------------------------------------------------*/
-
- static void readgcolr(C(Pgcolr *) colour, C(char *) prom)
- PreANSI(Pgcolr *colour)
- PreANSI(char *prom)
- /*
- ** read a general colour representation.
- */
- {
- char prompt[80];
-
- sprintf(prompt, "%s, colour type ? ", prom);
- colour->type = readinteger(prompt);
- switch (colour->type)
- {
- case PINDIRECT:
- sprintf(prompt, "%s, colour index ? ", prom);
- colour->val.ind = readintvalue(prompt, PTKECOLOURIND);
- break;
-
- case PMODEL_RGB:
- sprintf(prompt, "%s, red ? ", prom);
- colour->val.general.x = readreal(prompt);
- sprintf(prompt, "%s, green ? ", prom);
- colour->val.general.y = readreal(prompt);
- sprintf(prompt, "%s, blue ? ", prom);
- colour->val.general.z = readreal(prompt);
- break;
-
- case PMODEL_CIELUV:
- sprintf(prompt, "%s, x coefficient ? ", prom);
- colour->val.general.x = readreal(prompt);
- sprintf(prompt, "%s, y coefficient ? ", prom);
- colour->val.general.y = readreal(prompt);
- sprintf(prompt, "%s, y luminance ? ", prom);
- colour->val.general.z = readreal(prompt);
- break;
-
- case PMODEL_HSV:
- sprintf(prompt, "%s, hue ? ", prom);
- colour->val.general.x = readreal(prompt);
- sprintf(prompt, "%s, saturation ? ", prom);
- colour->val.general.y = readreal(prompt);
- sprintf(prompt, "%s, value ? ", prom);
- colour->val.general.z = readreal(prompt);
- break;
-
- case PMODEL_HLS:
- sprintf(prompt, "%s, hue ? ", prom);
- colour->val.general.x = readreal(prompt);
- sprintf(prompt, "%s, lightness ? ", prom);
- colour->val.general.y = readreal(prompt);
- sprintf(prompt, "%s, saturation ? ", prom);
- colour->val.general.z = readreal(prompt);
- break;
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* readgcolr */
-
- /*--------------------------------------------------------------------------*/
-
- static void readcolrep(C(Pint) colmodel, C(Pcolr_rep *) colour,
- C(char *) prompt)
- PreANSI(Pint colmodel)
- PreANSI(Pcolr_rep *colour)
- PreANSI(char *prompt)
- /*
- ** read a colour representation depending on the current
- ** colour model.
- */
- {
- char prom[80];
-
- switch (colmodel)
- {
- case PMODEL_RGB:
- sprintf(prom, "%s, red ? ", prompt);
- colour->rgb.red = readreal(prom);
- sprintf(prom, "%s, green ? ", prompt);
- colour->rgb.green = readreal(prom);
- sprintf(prom, "%s, blue ? ", prompt);
- colour->rgb.blue = readreal(prom);
- break;
-
- case PMODEL_CIELUV:
- sprintf(prom, "%s, x coefficient ? ", prompt);
- colour->cieluv.cieluv_x = readreal(prom);
- sprintf(prom, "%s, y coefficient ? ", prompt);
- colour->cieluv.cieluv_y = readreal(prom);
- sprintf(prom, "%s, y luminance ? ", prompt);
- colour->cieluv.cieluv_y_lum = readreal(prom);
- break;
-
- case PMODEL_HSV:
- sprintf(prom, "%s, hue ? ", prompt);
- colour->hsv.hue = readreal(prom);
- sprintf(prom, "%s, saturation ? ", prompt);
- colour->hsv.satur = readreal(prom);
- sprintf(prom, "%s, value ? ", prompt);
- colour->hsv.value = readreal(prom);
- break;
-
- case PMODEL_HLS:
- sprintf(prom, "%s, hue ? ", prompt);
- colour->hls.hue = readreal(prom);
- sprintf(prom, "%s, lightness ? ", prompt);
- colour->hls.lightness = readreal(prom);
- sprintf(prom, "%s, saturation ? ", prompt);
- colour->hls.satur = readreal(prom);
- break;
- }
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* readcolrep */
-
- /*--------------------------------------------------------------------------*/
-
- static void readcolreplist(C(Pint) colmodel, C(Pcolr_rep_list *) colours,
- C(char *) prompt)
- PreANSI(Pint colmodel)
- PreANSI(Pcolr_rep_list *colours)
- PreANSI(char *prompt)
- /*
- ** read a colour representation depending on the current
- ** colour model.
- */
- {
- Pint i;
- char prom[80];
-
- sprintf(prom, "%s, number of colours ? ", prompt);
- colours->num_colr_reps = readposinteger(prom);
- colours->colr_reps = (Pcolr_rep *)calloc(colours->num_colr_reps,
- sizeof(Pcolr_rep));
- for (i = 0; i < colours->num_colr_reps; i++)
- {
- sprintf(prom, "%s, colour [%d]", prompt, i);
- readcolrep(colmodel, &colours->colr_reps[i], prom);
- }
- } /* readcolreplist */
-
- /*--------------------------------------------------------------------------*/
-
- static void readcovalarray(C(Pint) colmodel, C(Pint) num,
- C(Pcoval *) colours)
- PreANSI(Pint colmodel)
- PreANSI(Pint num)
- PreANSI(Pcoval *colours)
- /*
- ** read a colour representation depending on the current
- ** colour model.
- */
- {
- Pint i;
-
- if (colmodel == PINDIRECT)
- for (i = 0; i < num; i++)
- colours[i].ind = readintvalue("colour index ? ", PTKECOLOURIND);
- else
- for (i = 0; i < num; i++)
- readdirectcolour(colmodel, &colours[i], "direct colour");
- } /* reacovalarray */
-
- /*--------------------------------------------------------------------------*/
-
- static void readreflprops(C(Prefl_props *) props, C(char *) prompt)
- PreANSI(Prefl_props *props)
- PreANSI(char *prompt)
- {
- char prom[80];
-
- sprintf(prom, "%s, ambient coefficient ? ", prompt);
- props->ambient_coef = readreal(prom);
- sprintf(prom, "%s, diffuse coefficient ? ", prompt);
- props->diffuse_coef = readreal(prom);
- sprintf(prom, "%s, specular coefficient ? ", prompt);
- props->specular_coef = readreal(prom);
- sprintf(prom, "%s, specular colour ? ", prompt);
- readgcolr(&props->specular_colr, prompt);
- sprintf(prom, "%s, specular exponent ? ", prompt);
- props->specular_exp = readreal(prom);
- sprintf(prom, "%s, transparency coefficient ? ", prompt);
- props->transpar_coef = readreal(prom);
- } /* readreflprops */
-
- /*--------------------------------------------------------------------------*/
-
- static void readlinebundleplus(C(Pline_bundle_plus *) bundl)
- PreANSI(Pline_bundle_plus *bundl)
- {
- bundl->type = readinteger("linetype ? ");
- bundl->width = readreal("linewidth scale factor ? ");
- readgcolr(&bundl->colr, "line colour");
- bundl->shad_meth = readinteger("line shading method ? ");
- bundl->approx_type = readinteger("curve approx type ? ");
- bundl->approx_val = readreal("curve approx value ? ");
- } /* readlinebundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readmarkerbundleplus(C(Pmarker_bundle_plus *) bundl)
- PreANSI(Pmarker_bundle_plus *bundl)
- {
- bundl->type = readinteger("marker type ? ");
- bundl->size = readreal("marker size scale factor ? ");
- readgcolr(&bundl->colr, "marker colour");
- } /* readmarkerbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readedgebundleplus(C(Pedge_bundle_plus *) bundl)
- PreANSI(Pedge_bundle_plus *bundl)
- {
- bundl->flag = readphigsenum(PTKEEDGEF, "edge flag ? ");
- bundl->type = readinteger("edgetype ? ");
- bundl->width = readreal("edgewidth scale factor ? ");
- readgcolr(&bundl->colr, "edge colour");
- } /* readedgebundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readinterbundleplus(C(Pint_bundle_plus *) bundl)
- PreANSI(Pint_bundle_plus *bundl)
- {
- bundl->style = readphigsenum(PTKEINTERSTYLE, "interior style ? ");
- bundl->style_ind = readinteger("interior style index ? ");
- readgcolr(&bundl->colr, "interior colour");
- bundl->refl_eqn = readinteger("reflectance model ? ");
- bundl->shad_meth = readinteger("shading method ? ");
- readreflprops(&bundl->refl_props, "reflectance properties");
- bundl->back_style = readphigsenum(PTKEINTERSTYLE, "back interior style ? ");
- bundl->back_style_ind = readinteger("back interior style index ? ");
- readgcolr(&bundl->back_colr, "back interior colour");
- bundl->back_refl_eqn = readinteger("back reflectance model ? ");
- bundl->back_shad_meth = readinteger("back shading method ? ");
- readreflprops(&bundl->back_refl_props, "back reflectance properties");
- bundl->approx_type = readinteger("approximation type ? ");
- bundl->approx_val[0] = readreal("approximation value, u ? ");
- bundl->approx_val[1] = readreal("approximation value, v ? ");
- } /* readinterbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readtextbundleplus(C(Ptext_bundle_plus *) bundl)
- PreANSI(Ptext_bundle_plus *bundl)
- {
- bundl->font = readinteger("text font ? ");
- bundl->prec = readphigsenum(PTKETXPREC, "text precision ? ");
- bundl->char_expan = readreal("character expansion factor ? ");
- bundl->char_space = readreal("character spacing ? ");
- readgcolr(&bundl->colr, "text colour");
- } /* readtextbundleplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpatrepplus(C(Ppat_rep_plus *) rep)
- PreANSI(Ppat_rep_plus *rep)
- {
- Pint i, numcols;
-
- rep->dims.size_x = readinteger("number of divisions along X ? ");
- rep->dims.size_y = readinteger("number of divisions along Y ? ");
- numcols = rep->dims.size_x * rep->dims.size_y;
- rep->type = readinteger("colour type ? ");
- rep->colr_array = (Pcoval *)calloc(numcols, sizeof(Pcoval));
- readcovalarray(rep->type, numcols, rep->colr_array);
- } /* readpatrepplus */
-
- /*--------------------------------------------------------------------------*/
-
- static void readdcuebundle(C(Pdcue_bundle *) bundl)
- PreANSI(Pdcue_bundle *bundl)
- {
- bundl->mode = readphigsenum(PTKEDCUEMODE, "depth cue mode ? ");
- bundl->ref_planes[0] = readreal("back reference plane ? ");
- bundl->ref_planes[1] = readreal("front reference plane ? ");
- bundl->scaling[0] = readreal("back scaling ? ");
- bundl->scaling[1] = readreal("front scaling ? ");
- readgcolr(&bundl->colr, "depth cue colour");
- } /* readdcuebundle */
-
- /*--------------------------------------------------------------------------*/
-
- static void readlightsrcbundle(C(Plight_src_bundle *) light)
- PreANSI(Plight_src_bundle *light)
- {
- light->type = readinteger("light source type ? ");
- switch (light->type)
- {
- case PLIGHT_AMBIENT:
- readgcolr(&light->rec.ambient.colr, "light source colour");
- break;
-
- case PLIGHT_DIRECTIONAL:
- readgcolr(&light->rec.directional.colr, "light source colour");
- light->rec.directional.dir = readvector3("light source direction");
- break;
-
- case PLIGHT_POSITIONAL:
- readgcolr(&light->rec.positional.colr, "light source colour");
- light->rec.positional.pos = readpoint3("light source position");
- light->rec.positional.coef[0] =
- readreal("attenuation coefficients [0] ? ");
- light->rec.positional.coef[1] =
- readreal("attenuation coefficients [1] ? ");
- break;
-
- case PLIGHT_SPOT:
- readgcolr(&light->rec.spot.colr, "light source colour");
- light->rec.spot.pos = readpoint3("light source position");
- light->rec.spot.dir = readvector3("light source direction");
- light->rec.spot.exp = readreal("concentration exponent ? ");
- light->rec.spot.coef[0] =
- readreal("attenuation coefficients [0] ? ");
- light->rec.spot.coef[1] =
- readreal("attenuation coefficients [1] ? ");
- light->rec.spot.angle = readreal("spread angle ? ");
- break;
- }
- } /* readlightsrcbundle */
-
- /*--------------------------------------------------------------------------*/
-
- static void readparasurfcharacs(C(Pint) psctype,
- C(Ppara_surf_characs *) psurf)
- PreANSI(Pint psctype)
- PreANSI(Ppara_surf_characs *psurf)
- {
- switch (psctype)
- {
- case PSC_NONE:
- break;
-
- case PSC_WS_DEP:
- break;
-
- case PSC_ISOPARAMETRIC_CURVES:
- psurf->psc_3.placement = readphigsenum(PTKECURVEPLACE,
- "curve placement ? ");
- psurf->psc_3.u_count = readinteger("u count ? ");
- psurf->psc_3.v_count = readinteger("v count ? ");
- break;
-
- case PSC_LEVEL_CURVES_MC:
- psurf->psc_4.origin = readpoint3("origin");
- psurf->psc_4.direction = readvector3("direction");
- readfloatlist(&psurf->psc_4.params, "params");
- break;
-
- case PSC_LEVEL_CURVES_WC:
- psurf->psc_5.origin = readpoint3("origin");
- psurf->psc_5.direction = readvector3("direction");
- readfloatlist(&psurf->psc_5.params, "params");
- break;
- }
- } /* readparasurfcharacs */
-
- /*--------------------------------------------------------------------------*/
-
- static void readfacetvdatalist3(C(Pint) vflag, C(Pint) colour_model,
- C(Pint) num, C(Pfacet_vdata_list3 *) vdata)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint num)
- PreANSI(Pfacet_vdata_list3 *vdata)
- /*
- ** read list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint j;
- char prom[80];
-
- sprintf(prom, "facet [%d], number of vertices ? ", num);
- vdata->num_vertices = readinteger(prom);
- switch (vflag)
- {
- case PVERT_COORD:
- vdata->vertex_data.points = (Ppoint3 *)calloc(vdata->num_vertices,
- sizeof(Ppoint3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.points[j] = readpoint3(prom);
- }
- break;
-
- case PVERT_COORD_COLOUR:
- vdata->vertex_data.ptcolrs = (Pptco3 *)calloc(vdata->num_vertices,
- sizeof(Pptco3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.ptcolrs[j].point = readpoint3(prom);
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "facet [%d], colour index [%d] ? ", num, j);
- vdata->vertex_data.ptcolrs[j].colr.ind =
- readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "facet [%d], direct colour [%d]", num, j);
- readdirectcolour(colour_model,
- vdata->vertex_data.ptcolrs[j].colr, prom);
- }
- }
- break;
-
- case PVERT_COORD_NORMAL:
- vdata->vertex_data.ptnorms =
- (Pptnorm3 *)calloc(vdata->num_vertices, sizeof(Pptnorm3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.ptnorms[j].point = readpoint3(prom);
- sprintf(prom, "facet [%d], normal [%d] ? ", num, j);
- vdata->vertex_data.ptnorms[j].norm = readvector3(prom);
- }
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- vdata->vertex_data.ptconorms =
- (Pptconorm3 *)calloc(vdata->num_vertices, sizeof(Pptconorm3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "facet [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.ptconorms[j].point = readpoint3(prom);
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "facet [%d], colour index [%d] ? ", num, j);
- vdata->vertex_data.ptconorms[j].colr.ind =
- readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "facet [%d], direct colour [%d]", num, j);
- readdirectcolour(colour_model,
- vdata->vertex_data.ptconorms[j].colr, prom);
- }
- sprintf(prom, "facet [%d], normal [%d] ? ", num, j);
- vdata->vertex_data.ptconorms[j].norm = readvector3(prom);
- }
- break;
- }
- } /* readfacetvdatalist3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readfacetvdataarr3(C(Pint) vflag, C(Pint) colour_model,
- C(Pint) nv, C(Pfacet_vdata_arr3 *) vdata)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint nv)
- PreANSI(Pfacet_vdata_arr3 *vdata)
- /*
- ** read list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint i, j;
- char prom[80];
-
- sprintf(prom, "facet [%d], number of vertices ? ", i);
- switch (vflag)
- {
- case PVERT_COORD:
- vdata->points = (Ppoint3 *)calloc(nv, sizeof(Ppoint3));
- for (i = 0; i < nv; i++)
- {
- sprintf(prom, "vertex [%d] ? ", i);
- vdata->points[i] = readpoint3(prom);
- }
- break;
-
- case PVERT_COORD_COLOUR:
- vdata->ptcolrs = (Pptco3 *)calloc(nv, sizeof(Pptco3));
- for (i = 0; i < nv; i++)
- {
- sprintf(prom, "vertex [%d] ? ", i);
- vdata->ptcolrs[i].point = readpoint3(prom);
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "colour index [%d] ? ", i);
- vdata->ptcolrs[i].colr.ind =
- readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "direct colour [%d]", i);
- readdirectcolour(colour_model,
- vdata->ptcolrs[i].colr, prom);
- }
- }
- break;
-
- case PVERT_COORD_NORMAL:
- vdata->ptnorms = (Pptnorm3 *)calloc(nv, sizeof(Pptnorm3));
- for (i = 0; i < nv; i++)
- {
- sprintf(prom, "vertex [%d] ? ", i);
- vdata->ptnorms[i].point = readpoint3(prom);
- sprintf(prom, "normal [%d] ? ", i);
- vdata->ptnorms[i].norm = readvector3(prom);
- }
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- vdata->ptconorms = (Pptconorm3 *)calloc(nv, sizeof(Pptconorm3));
- for (i = 0; i < nv; i++)
- {
- sprintf(prom, "vertex [%d] ? ", i);
- vdata->ptconorms[i].point = readpoint3(prom);
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "colour index [%d] ? ", i);
- vdata->ptconorms[i].colr.ind = readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "direct colour [%d]", i);
- readdirectcolour(colour_model,
- vdata->ptconorms[i].colr, prom);
- }
- sprintf(prom, "normal [%d] ? ", i);
- vdata->ptconorms[i].norm = readvector3(prom);
- }
- break;
- }
- } /* readfacetvdataarr3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readlinevdatalist3(C(Pint) vflag, C(Pint) colour_model,
- C(Pint) num, C(Pline_vdata_list3 *) vdata)
- PreANSI(Pint vflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint num)
- PreANSI(Pline_vdata_list3 *vdata)
- /*
- ** read list of nfa fill area set and optionally associated colour
- ** information.
- */
- {
- Pint j;
- char prom[80];
-
- sprintf(prom, "line [%d], number of vertices ? ", num);
- vdata->num_vertices = readinteger(prom);
- switch (vflag)
- {
- case PVERT_COORD:
- vdata->vertex_data.points = (Ppoint3 *)calloc(vdata->num_vertices,
- sizeof(Ppoint3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "line [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.points[j] = readpoint3(prom);
- }
- break;
-
- case PVERT_COORD_COLOUR:
- vdata->vertex_data.ptcolrs = (Pptco3 *)calloc(vdata->num_vertices,
- sizeof(Pptco3));
- for (j = 0; j < vdata->num_vertices; j++)
- {
- sprintf(prom, "line [%d], vertex [%d] ? ", num, j);
- vdata->vertex_data.ptcolrs[j].point = readpoint3(prom);
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "line [%d], colour index [%d] ? ", num, j);
- vdata->vertex_data.ptcolrs[j].colr.ind =
- readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "line [%d], direct colour [%d]", num, j);
- readdirectcolour(colour_model,
- vdata->vertex_data.ptcolrs[j].colr, prom);
- }
- }
- break;
- }
- } /* readlinevdatalist3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readfacetdata3(C(Pint) fflag, C(Pint) colour_model,
- C(Pfacet_data3 *) fdata)
- PreANSI(Pint fflag)
- PreANSI(Pint colour_model)
- PreANSI(Pfacet_data3 *fdata)
- /*
- ** read facet data record.
- */
- {
- char prom[80];
-
- switch (fflag)
- {
- case PFACET_NONE:
- break;
-
- case PFACET_COLOUR:
- if (colour_model == PINDIRECT)
- fdata->colr.ind = readintvalue("facet colour index ? ",
- PTKECOLOURIND);
- else
- readdirectcolour(colour_model, &fdata->colr, "facet direct colour");
- break;
-
- case PFACET_NORMAL:
- fdata->norm = readvector3("facet normal");
- break;
-
- case PFACET_COLOUR_NORMAL:
- if (colour_model == PINDIRECT)
- fdata->conorm.colr.ind = readintvalue("facet colour index ? ",
- PTKECOLOURIND);
- else
- readdirectcolour(colour_model, &fdata->conorm.colr,
- "facet direct colour");
- fdata->conorm.norm = readvector3("facet normal");
- break;
- }
- } /* readfacetdata3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readfacetdataarr3(C(Pint) fflag, C(Pint) colour_model,
- C(Pint) num, C(Pfacet_data_arr3 *) fdata)
- PreANSI(Pint fflag)
- PreANSI(Pint colour_model)
- PreANSI(Pint num)
- PreANSI(Pfacet_data_arr3 *fdata)
- /*
- ** read facet data record.
- */
- {
- char prom[80];
- Pint i;
-
- switch (fflag)
- {
- case PFACET_NONE:
- break;
-
- case PFACET_COLOUR:
- fdata->colrs = (Pcoval *)calloc(num, sizeof(Pcoval));
- if (colour_model == PINDIRECT)
- {
- for (i = 0; i < num; i++)
- {
- sprintf(prom, "facet colour [%d] ? ", i);
- fdata->colrs[i].ind = readintvalue(prom, PTKECOLOURIND);
- }
- }
- else
- {
- for (i = 0; i < num; i++)
- {
- sprintf(prom, "facet direct colour [%d]", i);
- readdirectcolour(colour_model, &fdata->colrs[i], prom);
- }
- }
- break;
-
- case PFACET_NORMAL:
- fdata->norms = (Pvec3 *)calloc(num, sizeof(Pvec3));
- for (i = 0; i < num; i++)
- {
- sprintf(prom, "facet normal [%d]", i);
- fdata->norms[i] = readvector3(prom);
- }
- break;
-
- case PFACET_COLOUR_NORMAL:
- fdata->conorms = (Pconorm3 *)calloc(num, sizeof(Pconorm3));
- for (i = 0; i < num; i++)
- {
- if (colour_model == PINDIRECT)
- {
- sprintf(prom, "facet colour [%d] ? ", i);
- fdata->conorms[i].colr.ind = readintvalue(prom, PTKECOLOURIND);
- }
- else
- {
- sprintf(prom, "facet direct colour [%d]", i);
- readdirectcolour(colour_model, &fdata->conorms[i].colr, prom);
- }
- sprintf(prom, "facet normal [%d]", i);
- fdata->conorms[i].norm = readvector3(prom);
- }
- break;
- }
- } /* readfacetdataarr3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readedgedatalist(C(Pint) num, C(Pedge_data_list *) edata)
- PreANSI(Pint num)
- PreANSI(Pedge_data_list *edata)
- /*
- ** read list of nfa edge information.
- */
- {
- Pint j;
- char prom[80];
-
- sprintf(prom, "facet [%d], number of edges ? ", num);
- edata->num_edges = readinteger(prom);
- edata->edgedata.edges = (Pedge_flag *)calloc(edata->num_edges,
- sizeof(Pedge_flag));
- for (j = 0; j < edata->num_edges; j++)
- {
- sprintf(prom, "facet [%d], edge flag [%d] ? ", num, j);
- edata->edgedata.edges[j] = readphigsenum(PTKEEDGEF, prom);
- }
- } /* readedgedatalist */
-
- /*--------------------------------------------------------------------------*/
-
- static void readedgedatalistlist(C(char *) prompt,
- C(Pedge_data_list_list *) edata)
- PreANSI(char *prompt)
- PreANSI(Pedge_data_list_list *edata)
- /*
- ** read list of edge lists information.
- */
- {
- Pint i, j;
- char prom[80];
-
- edata->num_lists = readinteger("number of bounds in facet ? ");
- edata->edgelist = (Pedge_data_list *)calloc(edata->num_lists,
- sizeof(Pedge_data_list));
- for (i = 0; i < edata->num_lists; i++)
- readedgedatalist(i, &edata->edgelist[i]);
- } /* readedgedatalist */
-
- /*--------------------------------------------------------------------------*/
-
- static Ppoint4 readpoint4(C(char *) prom)
- PreANSI(char *prom)
- {
- Ppoint4 t;
- char pointprom[255];
-
- sprintf(pointprom, "%s, x ? ", prom);
- t.x = readreal(pointprom);
- sprintf(pointprom, "%s, y ? ", prom);
- t.y = readreal(pointprom);
- sprintf(pointprom, "%s, z ? ", prom);
- t.z = readreal(pointprom);
- sprintf(pointprom, "%s, w ? ", prom);
- t.w = readreal(pointprom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- return t;
- } /* readpoint4 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointlist23(C(Prational) rationality,
- C(Ppoint_list23 *) plist, C(char *) prompt)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_list23 *plist)
- PreANSI(char *prompt)
- {
- Pint i, n;
- char prom[30];
-
- sprintf(prom, "%s, number of points ? ", prompt);
- plist->num_points = readinteger(prom);
- if (rationality == PRATIONAL)
- {
- plist->points.point3d = (Ppoint3 *)calloc(plist->num_points,
- sizeof(Ppoint3));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point3d[i] = readpoint3(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- else
- {
- plist->points.point2d = (Ppoint *)calloc(plist->num_points,
- sizeof(Ppoint));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point2d[i] = readpoint(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- } /* readpointlist23 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointlist34(C(Prational) rationality,
- C(Ppoint_list34 *) plist, C(char *) prompt)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_list34 *plist)
- PreANSI(char *prompt)
- {
- Pint i, n;
- char prom[30];
-
- sprintf(prom, "%s, number of points ? ", prompt);
- plist->num_points = readinteger(prom);
- if (rationality == PRATIONAL)
- {
- plist->points.point4d = (Ppoint4 *)calloc(plist->num_points,
- sizeof(Ppoint4));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point4d[i] = readpoint4(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- else
- {
- plist->points.point3d = (Ppoint3 *)calloc(plist->num_points,
- sizeof(Ppoint3));
- for (i = 0; i < plist->num_points; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point3d[i] = readpoint3(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- } /* readpointlist34 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readpointgrid34(C(Prational) rationality,
- C(Ppoint_grid34 *) plist, C(char *) prompt)
- PreANSI(Prational rationality)
- PreANSI(Ppoint_grid34 *plist)
- PreANSI(char *prompt)
- {
- Pint i, numpts;
- char prom[30];
-
- sprintf(prom, "%s, number of points along U ? ", prompt);
- plist->num_points.u_dim = readinteger(prom);
- sprintf(prom, "%s, number of points along V ? ", prompt);
- plist->num_points.v_dim = readinteger(prom);
- numpts = plist->num_points.u_dim * plist->num_points.v_dim;
- if (rationality == PRATIONAL)
- {
- plist->points.point4d = (Ppoint4 *)calloc(numpts, sizeof(Ppoint4));
- for (i = 0; i < numpts; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point4d[i] = readpoint4(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- else
- {
- plist->points.point3d = (Ppoint3 *)calloc(numpts, sizeof(Ppoint3));
- for (i = 0; i < numpts; i++)
- {
- sprintf(prom, "%s, point [%d]", prompt, i);
- plist->points.point3d[i] = readpoint3(prom);
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- }
- }
- } /* readpointgrid34 */
-
- /*--------------------------------------------------------------------------*/
-
- static void readtrimcurvelist(C(Ptrimcurve_list *) tlist, C(char *) prompt)
- PreANSI(Ptrimcurve_list *tlist)
- PreANSI(char *prompt)
- {
- Pint i, numpts;
- char prom[30];
-
- sprintf(prom, "%s, number of curves ? ", prompt);
- tlist->num_curves = readinteger(prom);
- tlist->curves = (Ptrimcurve *)calloc(tlist->num_curves,
- sizeof(Ptrimcurve));
- for (i = 0; i < tlist->num_curves; i++)
- {
- tlist->curves[i].visible = readphigsenum(PTKEEDGEF,
- "curve visibility flag ? ");
- tlist->curves[i].rationality = readphigsenum(PTKERATIONAL,
- "rationality ? ");
- tlist->curves[i].order = readinteger("order ? ");
- tlist->curves[i].approx_type = readinteger("approx type ? ");
- tlist->curves[i].approx_val = readreal("approx value ? ");
- readfloatlist(&tlist->curves[i].knots, "knots");
- tlist->curves[i].tmin = readreal("curve range, minimum ? ");
- tlist->curves[i].tmax = readreal("curve range, maximum ? ");
- readpointlist23(tlist->curves[i].rationality, &tlist->curves[i].cpts,
- "control points");
- }
- } /* readtrimcurvelist */
-
- /*--------------------------------------------------------------------------*/
-
- static void readcolrmapdata(C(Pint) method, C(Pcolr_map_data *) mdata,
- C(char *) prompt)
- PreANSI(Pint method)
- PreANSI(Pcolr_map_data *mdata)
- PreANSI(char *prompt)
- {
- Pint i;
- char prom[80];
-
- switch (method)
- {
- case PCOLR_MAP_TRUE:
- break;
-
- case PCOLR_MAP_PSEUDO:
- sprintf(prom, "%s, colour model ? ", prompt);
- mdata->meth_r2.colr_model = readinteger(prom);
- sprintf(prom, "%s, weights", prompt);
- readfloatlist(&mdata->meth_r2.weights, prom);
- sprintf(prom, "%s, colours", prompt);
- readcolreplist(mdata->meth_r2.colr_model, &mdata->meth_r2.colrs, prom);
- break;
-
- case PCOLR_MAP_PSEUDO_N:
- sprintf(prom, "%s, colour model ? ", prompt);
- mdata->meth_r3.colr_model = readinteger(prom);
- sprintf(prom, "%s, number of colours", prompt);
- mdata->meth_r3.colr_lists.num_lists = readinteger(prom);
- mdata->meth_r3.colr_lists.lists =
- (Pfloat_list *)calloc(mdata->meth_r3.colr_lists.num_lists,
- sizeof(Pfloat_list));
- for (i = 0; i < mdata->meth_r3.colr_lists.num_lists; i++)
- {
- sprintf(prom, "%s, colour [%d]", prompt, i);
- readfloatlist(&mdata->meth_r3.colr_lists.lists[i], prom);
- }
- break;
- }
- } /* readcolrmapdata */
-
- /*--------------------------------------------------------------------------*/
-
- #endif
-
- /*--------------------------------------------------------------------------*/
- /*---------------------- PHIGS functions -----------------------------------*/
- /*--------------------------------------------------------------------------*/
-
- static void do_paddnameset()
- {
- Pint_list addset;
-
- readintlst(&addset, "name set", PTKENAME);
- padd_names_set(&addset);
- free(addset.ints);
- } /* do_paddnameset */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pannotationtextrelative()
- {
- Ppoint refpt, offset;
- char str[255];
-
- refpt = readpoint("reference point");
- offset = readpoint("annotation offset");
- readquote(str, "annotation text string ? ");
- panno_text_rel(&refpt, &offset, str);
- } /* do_pannotationtextrelative */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pannotationtextrelative3()
- {
- Ppoint3 refpt, offset;
- char str[255];
-
- refpt = readpoint3("reference point");
- offset = readpoint3("annotation offset");
- readquote(str, "annotation text string ? ");
- panno_text_rel3(&refpt, &offset, str);
- } /* do_pannotationtextrelative3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_papplicationdata()
- {
- Pdata appldata;
- char applstr[255];
-
- appldata.data = applstr;
- readquote(applstr, "application data ? ");
- appldata.size = strlen(applstr) + 1;
- pappl_data(&appldata);
- } /* do_papplicationdata */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_parallstruct()
- {
- par_all_structs(readinteger("archive identifier ? "));
- } /* do_parallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_parstruct()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[50];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier ? ");
- sns.num_ints = readposinteger("number of structures to archive ? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- par_structs(libid, &sns);
- free(sns.ints);
- #endif
- } /* do_parstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_parstructnet()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[50];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier ? ");
- sns.num_ints = readposinteger("number of structure networks to archive ? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "root structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- par_struct_nets(libid, &sns);
- free(sns.ints);
- #endif
- } /* do_parstructnet */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pawait_event()
- {
- Pfloat timeout;
- Pint ws, devnum;
- Pin_class class;
-
- timeout = readreal("time out (seconds) ? ");
- pawait_event(timeout, &ws, &class, &devnum);
- } /* do_pawait_event */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pbuildtran()
- {
- Ppoint pt;
- Pvec shift;
- Pfloat angle;
- Pvec scale;
- Pint err;
-
- pt = readpoint("fixed point");
- shift = readvector("shift vector");
- angle = readreal("rotation angle ? ");
- scale = readvector("scale vector");
- pbuild_tran_matrix(&pt, &shift, angle, &scale, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pbuildtran */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pbuildtran3()
- {
- Ppoint3 pt;
- Pvec3 shift;
- Pfloat xangle, yangle, zangle;
- Pvec3 scale;
- Pint err;
-
- pt = readpoint3("fixed point");
- shift = readvector3("shift vector");
- xangle = readreal("rotation angle x ? ");
- yangle = readreal("rotation angle y ? ");
- zangle = readreal("rotation angle z ? ");
- scale = readvector3("scale vector");
- pbuild_tran_matrix3(&pt, &shift, xangle, yangle, zangle, &scale, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pbuildtran3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcellarray()
- {
- Prect rect;
- Ppat_rep colarray;
- Pint i;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- rect.p = readpoint("lower left of cell rectangle");
- rect.q = readpoint("upper right of cell rectangle");
- colarray.dims.size_x = readposinteger("number of cell divisions, x ? ");
- colarray.dims.size_y = readposinteger("number of cell divisions, y ? ");
- colarray.colr_array = (Pint *)calloc(colarray.dims.size_x *
- colarray.dims.size_y, sizeof(Pint));
- for (i = 0; i < colarray.dims.size_y; i++)
- readintarray(colarray.dims.size_x,
- &colarray.colr_array[i * colarray.dims.size_x],
- "colour index", PTKECOLOURIND);
- pcell_array(&rect, &colarray);
- free(colarray.colr_array);
- #endif
- } /* do_pcellarray */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcellarray3()
- {
- Pparal pgram;
- Ppat_rep colarray;
- Pint i;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- pgram.p = readpoint3("parallelogram, point p");
- pgram.q = readpoint3("parallelogram, point q");
- pgram.r = readpoint3("parallelogram, point r");
- colarray.dims.size_x = readposinteger("number of cell divisions, x ? ");
- colarray.dims.size_y = readposinteger("number of cell divisions, y ? ");
- colarray.colr_array = (Pint *)calloc(colarray.dims.size_x *
- colarray.dims.size_y, sizeof(Pint));
- for (i = 0; i < colarray.dims.size_y; i++)
- readintarray(colarray.dims.size_x,
- &colarray.colr_array[i * colarray.dims.size_x],
- "colour index", PTKECOLOURIND);
- pcell_array3(&pgram, &colarray);
- free(colarray.colr_array);
- #endif
- } /* do_pcellarray3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pchangestructid()
- {
- Pint old, new;
-
- old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
- new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
- pchange_struct_id(old, new);
- } /* do_pchangestructid */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pchangestructidref()
- {
- Pint old, new;
-
- old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
- new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
- pchange_struct_id_refs(old, new);
- } /* do_pchangestructidref */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pchangestructref()
- {
- Pint old, new;
-
- old = readintvalue("old structure identifier ? ", PTKESTRUCTID);
- new = readintvalue("new structure identifier ? ", PTKESTRUCTID);
- pchange_struct_refs(old, new);
- } /* do_pchangestructref */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pclosearfile()
- {
- Pint libid;
-
- libid = readinteger("archive identifier ? ");
- pclose_ar_file(libid);
- } /* do_pclosearfile */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pclosephigs()
- {
- pclose_phigs();
- } /* do_pclosephigs */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pclosestruct()
- {
- pclose_struct();
- } /* do_pclosestruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pclosews()
- {
- Pint wsid;
-
- wsid = readinteger("workstation identifier ? ");
- pclose_ws(wsid);
- } /* do_pclosews */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcomposematrix()
- {
- Pmatrix a, b;
- Pint err;
-
- readmatrix(a, "matrix a");
- readmatrix(b, "matrix b");
- pcompose_matrix(a, b, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "composed transformation matrix:\n");
- writematrix(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pcomposematrix */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcomposematrix3()
- {
- Pmatrix3 a, b;
- Pint err;
-
- readmatrix3(a, "matrix a");
- readmatrix3(b, "matrix b");
- pcompose_matrix3(a, b, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "composed transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pcomposematrix3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcomposetran()
- {
- Ppoint pt;
- Pvec shift;
- Pfloat angle;
- Pvec scale;
- Pint err;
- Pmatrix matrix;
-
- readmatrix(matrix, "matrix");
- pt = readpoint("fixed point");
- shift = readvector("shift vector");
- angle = readreal("rotation angle ? ");
- scale = readvector("scale vector");
- pcompose_tran_matrix(matrix, &pt, &shift, angle, &scale, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pcomposetran */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcomposetran3()
- {
- Ppoint3 pt;
- Pvec3 shift;
- Pfloat xangle, yangle, zangle;
- Pvec3 scale;
- Pint err;
- Pmatrix3 matrix, tm3;
-
- readmatrix3(matrix, "matrix");
- pt = readpoint3("fixed point");
- shift = readvector3("shift vector");
- xangle = readreal("rotation angle x ? ");
- yangle = readreal("rotation angle y ? ");
- zangle = readreal("rotation angle z ? ");
- scale = readvector3("scale vector");
- pcompose_tran_matrix3(matrix, &pt, &shift, xangle, yangle, zangle, &scale,
- &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pcomposetran3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pcopyallelemsstruct()
- {
- pcopy_all_elems_struct(readintvalue("structure identifier to copy ? ",
- PTKESTRUCTID));
- } /* do_pcopyallelemsstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelallstruct()
- {
- pdel_all_structs();
- } /* do_pdelallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelallstructar()
- {
- pdel_all_structs_ar(readinteger("archive identifier ? "));
- } /* pdel_all_structs_ar */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelelem()
- {
- pdel_elem();
- } /* do_pdelelem() */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelelemrange()
- {
- Pint e1, e2;
-
- e1 = readinteger("element to start ? ");
- e2 = readinteger("element to finish ? ");
- pdel_elem_range(e1, e2);
- } /* do_pdelelemrange */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelelemslabels()
- {
- Pint s1, s2;
-
- s1 = readintvalue("start label ? ", PTKELABELVAL);
- s2 = readintvalue("finish label ? ", PTKELABELVAL);
- pdel_elems_labels(s1, s2);
- } /* do_pdelelemslabels */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelstruct()
- {
- pdel_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
- } /* do_pdelstruct() */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelstructar()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[30];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier ? ");
- sns.num_ints = readposinteger("number of structures to delete ? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- pdel_structs_ar(libid, &sns);
- free(sns.ints);
- #endif
- } /* do_pdelstructar */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelstructnet()
- {
- Pint delstid;
- Pref_flag refflag;
-
- delstid = readintvalue("root structure identifier ? ", PTKESTRUCTID);
- refflag = readphigsenum(PTKEREFF, "reference handling flag ? ");
- pdel_struct_net(delstid, refflag);
- } /* do_pdelstructnet */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pdelstructnetar()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[30];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier ? ");
- sns.num_ints = readposinteger("number of structures to delete ? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- pdel_struct_nets_ar(libid, &sns);
- free(sns.ints);
- #endif
- } /* do_pdelstructnetar */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pelemsrch()
- {
- Pint stid, elptr;
- Psearch_dir dir;
- Pelem_type_list incl;
- Pelem_type_list excl;
- Pelem_type inclnames[255];
- Pelem_type exclnames[255];
- Pint err, foundel;
- Psearch_status status;
-
- stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
- elptr = readinteger("starting element pointer ? ");
- dir = readphigsenum(PTKESRCHDIR, "search direction ? ");
- incl.elem_types = inclnames;
- excl.elem_types = exclnames;
- incl.num_elem_types = readposinteger("length of element inclusion set ? ");
- readenumlist(incl.num_elem_types, incl.elem_types, PTKESRCHELTYPE,
- "element inclusion set");
- excl.num_elem_types = readposinteger("length of element exclusion set ? ");
- readenumlist(excl.num_elem_types, excl.elem_types, PTKESRCHELTYPE,
- "element exclusion set");
- pelem_search(stid, elptr, dir, &incl, &excl, &err, &status, &foundel);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "search status = ");
- writephigsenum(PTKEINFORM, PTKESRCHSTATUS, status);
- phinprintf(PTKEINFORM, "element number = ");
- writeinteger(PTKEINFORM, foundel);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pelemsrch */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pemergencyclosephigs()
- {
- pemergency_close_phigs();
- } /* do_pemergencyclosephigs */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pemptystruct()
- {
- pempty_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
- } /* do_pemptystruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_perrorhand()
- {
- Pint err_num, func_num;
- char err_file[80];
-
- err_num = readinteger("error number ? ");
- func_num = readinteger("function number ? ");
- readstring(err_file, "error file name ? ");
- perr_hand(err_num, func_num, err_file);
- } /* do_perrorhand */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_perrorlog()
- {
- Pint err_num, func_num;
- char err_file[80];
-
- err_num = readinteger("error number ? ");
- func_num = readinteger("function number ? ");
- readstring(err_file, "error file name ? ");
- perr_log(err_num, func_num, err_file);
- } /* do_perrorlog */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pescape()
- {
- phintererror(3, (char *)NULL, INFORM);
- } /* do_pescape */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pevalviewmappingmatrix()
- {
- Pview_map mapping;
- Pint err;
-
- mapping.win = readlimit("window limits");
- mapping.proj_vp = readlimit("viewport limits");
- peval_view_map_matrix(&mapping, &err, vmm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "view mapping matrix:\n");
- writematrix(PTKEINFORM, vmm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pevalviewmappingmatrix */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pevalviewmappingmatrix3()
- {
- Pview_map3 mapping;
- Pint err;
-
- mapping.win = readlimit("window limits");
- mapping.proj_vp = readlimit3("viewport limits");
- mapping.proj_type = readphigsenum(PTKEPROJTYPE, "projection type ? ");
- mapping.proj_ref_point = readpoint3("projection reference point");
- mapping.view_plane = readreal("view plane distance ? ");
- mapping.back_plane = readreal("back plane distance ? ");
- mapping.front_plane = readreal("front plane distance ? ");
- peval_view_map_matrix3(&mapping, &err, vmm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "view mapping matrix:\n");
- writematrix3(PTKEINFORM, vmm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pevalviewmappingmatrix3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pevalvieworientationmatrix()
- {
- Ppoint vrp;
- Pvec vup;
- Pint err;
-
- vrp = readpoint("view reference point");
- vup = readvector("view up vector");
- peval_view_ori_matrix(&vrp, &vup, &err, vom);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "view orientation matrix:\n");
- writematrix(PTKEINFORM, vom);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pevalvieworientationmatrix */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pevalvieworientationmatrix3()
- {
- Ppoint3 vrp;
- Pvec3 vup, vpn;
- Pint err;
-
- vrp = readpoint3("view reference point");
- vpn = readvector3("view plane normal");
- vup = readvector3("view up vector");
- peval_view_ori_matrix3(&vrp, &vpn, &vup, &err, vom3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "view orientation matrix:\n");
- writematrix3(PTKEINFORM, vom3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pevalvieworientationmatrix3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pexecutestruct()
- {
- pexec_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
- } /* do_pexecutestruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pfillarea()
- {
- Ppoint_list pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
- readpointarray(pts.num_points, pts.points);
- pfill_area(&pts);
- free(pts.points);
- } /* do_pfillarea */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pfillarea3()
- {
- Ppoint_list3 pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
- readpoint3array(pts.num_points, pts.points);
- pfill_area3(&pts);
- free(pts.points);
- } /* do_pfillarea3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pfillareaset()
- {
- Pint nb;
- Pint i, totalpts;
- Ppoint_list *sets;
-
- nb = readposinteger("number of sets? ");
- sets = (Ppoint_list *)calloc(nb, sizeof(Ppoint_list));
- for (i = 0; i < nb; i++)
- {
- readpointlst(&sets[i]);
- }
- ptk_fillareaset(nb, sets);
- for (i = 0; i < nb; i++)
- {
- free(sets[i].points);
- }
- free(sets);
- } /* do_pfillareaset */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pfillareaset3()
- {
- Pint nb;
- Pint i, totalpts;
- Ppoint_list3 *sets;
-
- nb = readposinteger("number of sets? ");
- sets = (Ppoint_list3 *)calloc(nb, sizeof(Ppoint_list3));
- for (i = 0; i < nb; i++)
- {
- readpointlst3(&sets[i]);
- }
- ptk_fillareaset3(nb, sets);
- for (i = 0; i < nb; i++)
- {
- free(sets[i].points);
- }
- free(sets);
- } /* do_pfillareaset3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pflush_events()
- {
- Pint ws, dev;
- Pin_class class;
-
- ws = readinteger("workstation identifier ? ");
- class = readphigsenum(PTKEICLASS, "device class ? ");
- dev = readinteger("input device number ? ");
- pflush_events(ws, class, dev);
- } /* do_pflush_events */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pgdp()
- {
- Pint gdpid, i;
- Ppoint_list pts;
- Pgdp_data gdprec;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
- readpointarray(pts.num_points, pts.points);
- gdpid = readinteger("gdp function identifier ? ");
- switch (gdpid)
- {
- #ifdef SUN
- case -2:
- gdprec.gdp_u2.center = readpoint("circle centre");
- gdprec.gdp_u2.radius = readreal("circle radius ? ");
- break;
-
- case -3:
- gdprec.gdp_u3.center = readpoint("circle centre");
- gdprec.gdp_u3.radius = readreal("circle radius ? ");
- gdprec.gdp_u3.st_ang = readreal("start angle ? ");
- gdprec.gdp_u3.end_ang = readreal("end angle ? ");
- break;
-
- case -4:
- gdprec.gdp_u4.center = readpoint("circle centre");
- gdprec.gdp_u4.radius = readreal("circle radius ? ");
- gdprec.gdp_u4.st_ang = readreal("start angle ? ");
- gdprec.gdp_u4.end_ang = readreal("end angle ? ");
- gdprec.gdp_u4.cls_type = readinteger("close type ? ");
- break;
-
- case -5:
- gdprec.gdp_u5.center = readpoint("circle centre");
- gdprec.gdp_u5.radius = readreal("circle radius ? ");
- break;
-
- case -6:
- gdprec.gdp_u6.center = readpoint("circle centre");
- gdprec.gdp_u6.radius = readreal("circle radius ? ");
- gdprec.gdp_u6.st_ang = readreal("start angle ? ");
- gdprec.gdp_u6.end_ang = readreal("end angle ? ");
- break;
-
- case -7:
- gdprec.gdp_u7.center = readpoint("circle centre");
- gdprec.gdp_u7.radius = readreal("circle radius ? ");
- gdprec.gdp_u7.st_ang = readreal("start angle ? ");
- gdprec.gdp_u7.end_ang = readreal("end angle ? ");
- gdprec.gdp_u7.cls_type = readinteger("close type ? ");
- break;
-
- case -8:
- gdprec.gdp_u8.center = readpoint("ellipse centre");
- gdprec.gdp_u8.major = readvector("major axis");
- gdprec.gdp_u8.minor = readvector("minor axis");
- break;
-
- case -9:
- gdprec.gdp_u9.center = readpoint("ellipse centre");
- gdprec.gdp_u9.major = readvector("major axis");
- gdprec.gdp_u9.minor = readvector("minor axis");
- gdprec.gdp_u9.st_ang = readreal("start angle ? ");
- gdprec.gdp_u9.end_ang = readreal("end angle ? ");
- break;
-
- case -10:
- gdprec.gdp_u10.center = readpoint("ellipse centre");
- gdprec.gdp_u10.major = readvector("major axis");
- gdprec.gdp_u10.minor = readvector("minor axis");
- gdprec.gdp_u10.st_ang = readreal("start angle ? ");
- gdprec.gdp_u10.end_ang = readreal("end angle ? ");
- gdprec.gdp_u10.cls_type = readinteger("close type ? ");
- break;
-
- case -11:
- gdprec.gdp_u11.center = readpoint("ellipse centre");
- gdprec.gdp_u11.major = readvector("major axis");
- gdprec.gdp_u11.minor = readvector("minor axis");
- break;
-
- case -12:
- gdprec.gdp_u12.center = readpoint("ellipse centre");
- gdprec.gdp_u12.major = readvector("major axis");
- gdprec.gdp_u12.minor = readvector("minor axis");
- gdprec.gdp_u12.st_ang = readreal("start angle ? ");
- gdprec.gdp_u12.end_ang = readreal("end angle ? ");
- break;
-
- case -13:
- gdprec.gdp_u13.center = readpoint("ellipse centre");
- gdprec.gdp_u13.major = readvector("major axis");
- gdprec.gdp_u13.minor = readvector("minor axis");
- gdprec.gdp_u13.st_ang = readreal("start angle ? ");
- gdprec.gdp_u13.end_ang = readreal("end angle ? ");
- gdprec.gdp_u13.cls_type = readinteger("close type ? ");
- break;
-
- case -14:
- break;
- #endif
- }
- pgdp(&pts, gdpid, &gdprec);
- } /* do_pgdp */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pgdp3()
- {
- #ifdef SUN
- phintererror(3, (char *)NULL, INFORM);
- #endif
- #ifdef VMS
- phintererror(1, (char *)NULL, INFORM);
- #endif
- } /* do_pgdp3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pgse()
- {
- #ifdef SUN
- phintererror(3, (char *)NULL, INFORM);
- #endif
- #ifdef VMS
- phintererror(1, (char *)NULL, INFORM);
- #endif
- } /* do_pgse */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_choice()
- {
- Pin_status status;
- Pint choice;
-
- pget_choice(&status, &choice);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "choice = ");
- writeinteger(PTKEINFORM, choice);
- }
- }
- } /* do_pget_choice */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pgettypemf()
- {
- phintererror(1, (char *)NULL, INFORM);
- } /* do_pgettypemf */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_loc()
- {
- Pint view_index;
- Ppoint pos;
-
- pget_loc(&view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint(PTKEINFORM, &pos);
- }
- } /* do_pget_loc */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_loc3()
- {
- Pint view_index;
- Ppoint3 pos;
-
- pget_loc3(&view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint3(PTKEINFORM, &pos);
- }
- } /* do_pget_loc3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_pick()
- {
- Pint depth;
- Pin_status status;
- Ppick_path pick;
-
- depth = readposinteger("depth of pick path ? ");
- pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
- pick.depth = depth;
- pget_pick(depth, &status, &pick);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "pick path:\n");
- writepickpath(PTKEINFORM, &pick.path_list);
- }
- }
- free(pick.path_list);
- } /* do_pget_pick */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_string()
- {
- char string[255];
-
- pget_string(string);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "string = \"%s\"\n", string);
- }
- } /* do_pget_string */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_stroke()
- {
- Pint view_index;
- Ppoint_list stroke;
- Ppoint pts[255];
-
- stroke.points = pts;
- pget_stroke(&view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
- }
- } /* do_pget_stroke */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_stroke3()
- {
- Pint view_index;
- Ppoint_list3 stroke;
- Ppoint3 pts[255];
-
- stroke.points = pts;
- pget_stroke3(&view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
- }
- } /* do_pget_stroke3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pget_val()
- {
- Pfloat val;
-
- pget_val(&val);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "value = ");
- writereal(PTKEINFORM, val);
- }
- } /* do_pget_val */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pincrspasrch()
- {
- Ppoint ref;
- Pfloat dist;
- Pelem_ref_list sp, fp;
- Pint ceil, len, st, err, totlen, i;
- Pfilter_list norm, inv;
- Pclip_ind clipflag;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- ref = readpoint("search reference point");
- dist = readreal("search distance ? ");
- readexecreflst(&sp, "starting path list");
- clipflag = readphigsenum(PTKECLIP, "model clip flag ? ");
- ceil = readinteger("search ceiling index ? ");
- readfilterlst(&norm, "normal filter list");
- readfilterlst(&inv, "inverted filter list");
- st = readposinteger("starting position ? ");
- pincr_spa_search(&ref, dist, &sp, clipflag,
- ceil, &norm, &inv, 0, st, &err, &fp, &totlen);
- fp.elem_refs = (Pelem_ref *)calloc(totlen, sizeof(Pelem_ref));
- pincr_spa_search(&ref, dist, &sp, clipflag,
- ceil, &norm, &inv, totlen, st, &err, &fp, &totlen);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- for (i = 0; i < totlen; i++)
- {
- phinprintf(PTKEINFORM, "structure identifier = ");
- writeintvalue(PTKEINFORM, fp.elem_refs[i].struct_id, PTKESTRUCTID);
- phinprintf(PTKEINFORM, "element number = ");
- writeinteger(PTKEINFORM, fp.elem_refs[i].elem_pos);
- }
- }
- else
- phigserror(PTKEINFORM, err);
- }
- #endif
- } /* do_pincrspasrch */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pincrspasrch3()
- {
- Ppoint3 ref;
- Pfloat dist;
- Pelem_ref_list sp, fp;
- Pint ceil, len, st, err, totlen, i;
- Pfilter_list norm, inv;
- Pclip_ind clipflag;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- ref = readpoint3("search reference point");
- dist = readreal("search distance ? ");
- readexecreflst(&sp, "starting path list");
- clipflag = readphigsenum(PTKECLIP, "model clip flag ? ");
- ceil = readinteger("search ceiling index ? ");
- readfilterlst(&norm, "normal filter list");
- readfilterlst(&inv, "inverted filter list");
- st = readposinteger("starting position ? ");
- pincr_spa_search3(&ref, dist, &sp, clipflag,
- ceil, &norm, &inv, 0, st, &err, &fp, &totlen);
- fp.elem_refs = (Pelem_ref *)calloc(totlen, sizeof(Pelem_ref));
- pincr_spa_search3(&ref, dist, &sp, clipflag,
- ceil, &norm, &inv, totlen, st, &err, &fp, &totlen);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- for (i = 0; i < totlen; i++)
- {
- phinprintf(PTKEINFORM, "structure identifier = ");
- writeintvalue(PTKEINFORM, fp.elem_refs[i].struct_id, PTKESTRUCTID);
- phinprintf(PTKEINFORM, "element number = ");
- writeinteger(PTKEINFORM, fp.elem_refs[i].elem_pos);
- }
- }
- else
- phigserror(PTKEINFORM, err);
- }
- #endif
- } /* do_pincrspasrch3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_choice()
- {
- Pint wsid, dev, init, pet;
- Pin_status status;
- Plimit echo;
- Pchoice_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("choice device number ? ");
- status = readphigsenum(PTKEISTATUS, "initial choice status ? ");
- init = readposinteger("initial choice ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- readchoicerec(dev, pet, &record);
- pinit_choice(wsid, dev, status, init, pet, &echo, &record);
- } /* do_pinit_choice */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_choice3()
- {
- Pint wsid, dev, init, pet;
- Pin_status status;
- Plimit3 echo;
- Pchoice_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("choice device number ? ");
- status = readphigsenum(PTKEISTATUS, "initial choice status ? ");
- init = readposinteger("initial choice ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- readchoicerec3(dev, pet, &record);
- pinit_choice3(wsid, dev, status, init, pet, &echo, &record);
- } /* do_pinit_choice3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_loc()
- {
- Pint wsid, dev, pet, initview;
- Ppoint initpos;
- Plimit echo;
- Ploc_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
- initpos = readpoint("initial position");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- readlocrec(dev, pet, &record);
- pinit_loc(wsid, dev, initview, &initpos, pet, &echo, &record);
- } /* do_pinit_loc */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_loc3()
- {
- Pint wsid, dev, pet, initview;
- Ppoint3 initpos;
- Plimit3 echo;
- Ploc_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
- initpos = readpoint3("initial position");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- readlocrec3(dev, pet, &record);
- pinit_loc3(wsid, dev, initview, &initpos, pet, &echo, &record);
- } /* do_pinit_loc3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_pick()
- {
- Pint wsid, dev, pet;
- Pin_status status;
- Ppick_path init;
- Plimit echo;
- Ppick_data record;
- Ppath_order order;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("pick device number ? ");
- status = readphigsenum(PTKEISTATUS, "initial pick status ? ");
- readpickpath(&init, "initial pick path");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- /* read data record depending on dev, pet */
- readpickrec(dev, pet, &record);
- order = readphigsenum(PTKEPATHORDER, "pick path order ? ");
- pinit_pick(wsid, dev, status, &init, pet, &echo, &record, order);
- } /* do_pinit_pick */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_pick3()
- {
- Pint wsid, dev, pet;
- Pin_status status;
- Ppick_path init;
- Plimit3 echo;
- Ppick_data record;
- Ppath_order order;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("pick device number ? ");
- status = readphigsenum(PTKEISTATUS, "initial pick status ? ");
- /* read initial pick path */
- readpickpath(&init, "initial pick path");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- /* read data record depending on dev, pet */
- readpickrec3(dev, pet, &record);
- order = readphigsenum(PTKEPATHORDER, "pick path order ? ");
- pinit_pick3(wsid, dev, status, &init, pet, &echo, &record, order);
- } /* do_pinit_pick3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_string()
- {
- Pint wsid, dev, pet;
- char init[255];
- Plimit echo;
- Pstring_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("string device number ? ");
- readquote(init, "initial string ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- /* read data record depending on dev, pet */
- readstringrec(dev, pet, &record);
- pinit_string(wsid, dev, init, pet, &echo, &record);
- } /* do_pinit_string */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_string3()
- {
- Pint wsid, dev, pet;
- char init[255];
- Plimit3 echo;
- Pstring_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("string device number ? ");
- readquote(init, "initial string ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- /* read data record depending on dev, pet */
- readstringrec3(dev, pet, &record);
- pinit_string(wsid, dev, init, pet, &echo, &record);
- } /* do_pinit_string3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_stroke()
- {
- Pint wsid, dev, pet, i, initview;
- Ppoint_list initpts;
- Plimit echo;
- Pstroke_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
- initpts.num_points = readposinteger("initial number of points ? ");
- initpts.points = (Ppoint *)calloc(initpts.num_points, sizeof(Ppoint));
- for (i = 0; i < initpts.num_points; i++)
- initpts.points[i] = readpoint("initial points");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- /* read data record depending on dev, pet */
- readstrokerec(dev, pet, &record);
- pinit_stroke(wsid, dev, initview, &initpts, pet, &echo, &record);
- free(initpts.points);
- } /* do_pinit_stroke */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_stroke3()
- {
- Pint wsid, dev, pet, i, initview;
- Ppoint_list3 initpts;
- Plimit3 echo;
- Pstroke_data3 record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- initview = readposintvalue("initial view index ? ", PTKEVIEWIND);
- initpts.num_points = readposinteger("initial number of points ? ");
- initpts.points = (Ppoint3 *)calloc(initpts.num_points, sizeof(Ppoint3));
- for (i = 0; i < initpts.num_points; i++)
- initpts.points[i] = readpoint3("initial points");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- /* read data record depending on dev, pet */
- readstrokerec3(dev, pet, &record);
- pinit_stroke3(wsid, dev, initview, &initpts, pet, &echo, &record);
- free(initpts.points);
- } /* do_pinit_stroke3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_val()
- {
- Pint wsid, dev, pet;
- Pfloat init;
- Plimit echo;
- Pval_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("valuator device number ? ");
- init = readreal("initial value ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit("echo area");
- /* read data record depending on dev, pet */
- readvalrec(dev, pet, &record);
- pinit_val(wsid, dev, init, pet, &echo, &record);
- } /* do_pinit_val */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinit_val3()
- {
- Pint wsid, dev, pet;
- Pfloat init;
- Plimit3 echo;
- Pval_data record;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("valuator device number ? ");
- init = readreal("initial value ? ");
- pet = readinteger("prompt and echo type ? ");
- echo = readlimit3("echo volume");
- /* read data record depending on dev, pet */
- readvalrec3(dev, pet, &record);
- pinit_val3(wsid, dev, init, pet, &echo, &record);
- } /* do_pinit_val3 */
-
- /*--------------------------------------------------------------------------*/
-
- #include "pinqfns.c"
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pinterpret()
- {
- phintererror(1, (char *)NULL, INFORM);
- } /* do_pinterpret */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_plabel()
- {
- plabel(readintvalue("label ? ", PTKELABELVAL));
- } /* do_plabel */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pmessage()
- {
- Pint wsid;
- char str[255];
-
- wsid = readinteger("workstation identifier ? ");
- readquote(str, "message ? ");
- pmessage(wsid, str);
- } /* do_pmessage */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_poffsetelemptr()
- {
- poffset_elem_ptr(readinteger("offset ? "));
- } /* do_poffsetelemptr */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_popenarfile()
- {
- Pint lib_id;
- char s[201];
-
- readargument(s, "archive file name ? ");
- lib_id = readinteger("archive identifier ? ");
- popen_ar_file(lib_id, s);
- } /* do_popenarfile */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_popenphigs()
- {
- char errfile[255];
- Pint size;
- char *errf;
-
- readargument(errfile, "name of error logging file ? ");
- if ((strcmp(errfile, "NULL") == 0) || (strcmp(errfile, "0") == 0))
- /* Implementation dependent - HP PHIGS doesn't like to use
- ** PDEF_ERR_FILE in open_phigs.
- */
- #ifndef HP
- /* do for SUN and PEXSI */
- errf = PDEF_ERR_FILE;
- #endif
- #ifdef HP
- errf = stderr;
- #endif
- else
- #ifndef HP
- /* do for SUN and PEXSI */
- errf = errfile;
- #endif
- #ifdef HP
- errf = fopen(errfile, "w+");
- #endif
- size = readposinteger("number of memory units ? ");
- if (size == 0)
- size = PDEF_MEM_SIZE;
- popen_phigs(errf, (Pint)size);
- } /* do_popenphigs */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_popenstruct()
- {
- popen_struct(readintvalue("structure identifier ? ", PTKESTRUCTID));
- } /* do_popenstruct */
-
- /*--------------------------------------------------------------------------*/
-
- #ifdef SUN
- static setwstype(C(Pint *) wst)
- PreANSI(Pint *wst)
- {
- Pint numwdt, i, wsint;
- ptkewstypeattr phigsattr;
- Pfloat wsreal;
-
- numwdt = readposinteger("number of WDT items ? ");
- for (i = 0; i < numwdt; i++)
- {
- phigsattr = readphigsenum(PTKEWSTYPEATTR, "workstation attribute ? ");
- switch (phigsattr)
- {
- case BASE_NAME: /* can't be set */ break;
-
- case DOUBLE_BUFFER:
- {
- Pint buff;
-
- buff = readinteger("double buffering method ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_BUF_MODE, buff, 0);
- }
- break;
-
- case NORM_CURSOR_TYPE:
- {
- Phigs_cursor_type cursor;
-
- cursor = readphigsenum(PTKECURSORTYPE, "normal cursor type ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_NORM_CURSOR_TYPE,
- cursor, 0);
- }
- break;
-
- case NORM_CURSOR_COLOUR:
- {
- Prgb color;
-
- color.red = readreal("normal cursor colour, red ? ");
- color.green = readreal("normal cursor colour, green ? ");
- color.blue = readreal("normal cursor colour, blue ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_NORM_CURSOR_COLOUR,
- &color, 0);
- }
- break;
-
- case TRAV_CURSOR_TYPE:
- {
- Phigs_cursor_type cursor;
-
- cursor = readphigsenum(PTKECURSORTYPE, "traversal cursor type ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TRAV_CURSOR_TYPE,
- cursor, 0);
- }
- break;
-
- case TRAV_CURSOR_COLOUR:
- {
- Prgb color;
-
- color.red = readreal("traversal cursor colour, red ? ");
- color.green = readreal("traversal cursor colour, green ? ");
- color.blue = readreal("traversal cursor colour, blue ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TRAV_CURSOR_COLOUR,
- &color, 0);
- }
- break;
-
- case ACCELERATOR_USAGE:
- {
- Phigs_acc_usage accusage;
-
- accusage = readphigsenum(PTKEACCUSAGE, "accelerator usage ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_ACCELERATOR_USAGE,
- accusage, 0);
- }
- break;
-
- case COLOUR_MODE:
- {
- Phigs_colr_mode cmode;
-
- cmode = readphigsenum(PTKECOLOURMODE, "colour mode ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_COLOUR_MODE, cmode, 0);
- }
- break;
-
- case TOOL_WIDTH:
- wsint = readposinteger("tool window width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_WIDTH, wsint, 0);
- break;
-
- case TOOL_HEIGHT:
- wsint = readposinteger("tool window height ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_HEIGHT, wsint, 0);
- break;
-
- case TOOL_X:
- wsint = readposinteger("tool window position, x ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_X, wsint, 0);
- break;
-
- case TOOL_Y:
- wsint = readposinteger("tool window position, y ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_Y, wsint, 0);
- break;
-
- case TOOL_LABEL:
- {
- char label[255];
-
- readquote(label, "frame banner ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_LABEL, label, 0);
- }
- break;
-
- case TOOL_ICON_FILE:
- {
- char path[255];
-
- readquote(path, "icon definition file ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_FILE,
- path, 0);
- }
- break;
-
- case TOOL_ICON_LABEL:
- {
- char label[255];
-
- readquote(label, "icon label ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_LABEL,
- label, 0);
- }
- break;
-
- case TOOL_BORDER_WIDTH:
- wsint = readposinteger("tool window border width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_BORDER_WIDTH,
- wsint, 0);
- break;
-
- case WS_CATEGORY:
- {
- Pws_cat wscat;
-
- wscat = readphigsenum(PTKEWSCAT, "workstation category ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WS_CATEGORY, wscat, 0);
- }
- break;
-
- case COLOUR_TABLE_SIZE:
- wsint = readposinteger("colour table size ? ");
- if (wsint > 256)
- wsint = 256;
- /* SunPHIGS: max on indexed color ws = 256
- ** max on true color ws = 4096
- */
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_COLOUR_TABLE_SIZE,
- wsint, 0);
- break;
-
- case WST_NUM_VIEW_REP:
- wsint = readposinteger("view table size ? ");
- if (wsint < 6)
- wsint = 6;
- /* SunPHIGS: min = 6 */
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WST_NUM_VIEW_REP,
- wsint, 0);
- break;
-
- case X_CMAP_PROP_ATOM:
- wsint = readinteger("property atom ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_CMAP_PROP_ATOM,
- wsint, 0);
- break;
-
- case DC_MODEL:
- {
- Phigs_DC_model model;
-
- model = readphigsenum(PTKEDCMODEL, "DC model ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_DC_MODEL,
- model, 0);
- }
- break;
-
- case SIMULATE_PICK:
- {
- Phigs_simulate_pick pick;
-
- pick = readphigsenum(PTKESIMULATEPICK, "pick simulation ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_SIMULATE_PICK,
- pick, 0);
- }
- break;
-
- case STEREO:
- wsint = readinteger("stereo ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_STEREO, wsint, 0);
- break;
-
- case X_DISPLAY_NAME:
- {
- char name[80];
-
- readquote(name, "display name ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_DISPLAY_NAME,
- name, 0);
- }
- break;
-
- case CGM_ENCODING:
- {
- Phigs_cgm_encoding encode;
-
- encode = readphigsenum(PTKECGMENCODING, "CGM encoding ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_ENCODING,
- encode, 0);
- }
- break;
-
- case CGM_CONFORMANCE:
- {
- Phigs_cgm_conformance conform;
-
- conform = readphigsenum(PTKECGMCONFORMANCE, "CGM conformance ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_CONFORMANCE,
- conform, 0);
- }
- break;
-
- case CGM_METRIC_HEIGHT_PTR:
- wsreal = readreal("CGM drawing height ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_METRIC_HEIGHT_PTR,
- &wsreal, 0);
- break;
-
- case CGM_METRIC_WIDTH_PTR:
- wsreal = readreal("CGM drawing width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_METRIC_WIDTH_PTR,
- &wsreal, 0);
- break;
-
- case CGM_METRIC_LINE_WIDTH_PTR:
- wsreal = readreal("CGM line width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst,
- PHIGS_CGM_METRIC_LINE_WIDTH_PTR, &wsreal, 0);
- break;
-
- case CGM_VDC_PRECISION:
- {
- Phigs_cgm_vdc_precision prec;
-
- prec = readphigsenum(PTKECGMVDCPRECISION, "CGM precision ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_CGM_VDC_PRECISION,
- prec, 0);
- }
- break;
-
- case REGION_RECT:
- {
- Prect region;
-
- region.p.x = readreal("lower left, x ? ");
- region.p.y = readreal("lower left, y ? ");
- region.q.x = readreal("upper right, x ? ");
- region.q.y = readreal("upper right, y ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_RECT,
- ®ion, 0);
- }
- break;
-
- case REGION_PRIORITY:
- wsreal = readreal("region priority ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_PRIORITY,
- &wsreal, 0);
- break;
-
- case REGION_BACKGROUND:
- {
- Phigs_bg_clear region;
-
- region = readphigsenum(PTKEBGCLEAR, "background clear ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_REGION_BACKGROUND,
- region, 0);
- }
- break;
-
- case USE_DECOMP:
- {
- Phigs_dcmp dcmp;
-
- dcmp = readphigsenum(PTKEUSEDECOMP, "use decomposition ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_USE_DECOMP,
- dcmp, 0);
- }
- break;
-
- default: phintererror(2, "No such attribute.\n", INFORM);
-
- }
- }
- }
- #endif
-
- /*--------------------------------------------------------------------------*/
-
- #ifdef PEXSI
- static setwstype(C(Pint *) wst)
- PreANSI(Pint *wst)
- {
- Pint numwdt, i, wsint;
- ptkewstypeattr phigsattr;
- Pfloat wsreal;
-
- numwdt = readinteger("number of WDT items ? ");
- for (i = 0; i < numwdt; i++)
- {
- phigsattr = readphigsenum(PTKEWSTYPEATTR, "workstation attribute ? ");
- switch (phigsattr)
- {
- case BASE_NAME: /* can't be set */ break;
-
- case DOUBLE_BUFFER:
- {
- Pint buff;
-
- buff = readinteger("double buffering method ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_BUF_MODE, buff, NULL);
- }
- break;
-
- case TOOL_WIDTH:
- wsint = readposinteger("tool window width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_WIDTH, wsint, NULL);
- break;
-
- case TOOL_HEIGHT:
- wsint = readposinteger("tool window height ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_HEIGHT, wsint, NULL);
- break;
-
- case TOOL_X:
- wsint = readposinteger("tool window position, x ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_X, wsint, NULL);
- break;
-
- case TOOL_Y:
- wsint = readposinteger("tool window position, y ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_Y, wsint, NULL);
- break;
-
- case TOOL_LABEL:
- {
- char label[255];
-
- readquote(label, "frame banner ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_LABEL, label, NULL);
- }
- break;
-
- case TOOL_ICON_LABEL:
- {
- char label[255];
-
- readquote(label, "icon label ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_ICON_LABEL,
- label, NULL);
- }
- break;
-
- case TOOL_BORDER_WIDTH:
- wsint = readposinteger("tool window border width ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_TOOL_BORDER_WIDTH,
- wsint, NULL);
- break;
-
- case WS_CATEGORY:
- {
- Pws_cat wscat;
-
- wscat = readphigsenum(PTKEWSCAT, "workstation category ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_WS_CATEGORY, wscat, NULL);
- }
- break;
-
- case X_CMAP_PROP_ATOM:
- wsint = readinteger("property atom ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_CMAP_PROP_ATOM,
- wsint, NULL);
- break;
-
- case DC_MODEL:
- {
- Phigs_DC_model model;
-
- model = readphigsenum(PTKEDCMODEL, "DC model ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_DC_MODEL,
- model, NULL);
- }
- break;
-
- case X_DISPLAY_NAME:
- {
- char name[80];
-
- readquote(name, "display name ? ");
- *wst = (Pint)phigs_ws_type_set(*wst, PHIGS_X_DISPLAY_NAME,
- name, NULL);
- }
- break;
-
- default: phintererror(2, "No such attribute.\n", INFORM);
- }
- }
- }
- #endif
-
- /*--------------------------------------------------------------------------*/
-
- static void do_popenws()
- {
- Pint wsid;
- char conn[255];
- Pint wst;
- #ifdef HP
- Pint connid;
- #endif
-
- wsid = readinteger("workstation identifier ? ");
- readargument(conn, "connection identifier ? ");
- readwstype(&wst);
- #ifdef SUN
- setwstype(&wst);
- #endif
- #ifdef PEXSI
- setwstype(&wst);
- #endif
- #ifdef VMS
- if (strncmp(conn, "0", 1) == 0)
- popen_ws(wsid, (Pconnid)0, wst);
- else
- #endif
- #ifdef HP
- pue004(conn, &connid, strlen(conn));
- popen_ws(wsid, connid, wst);
- #endif
- #ifndef HP
- popen_ws(wsid, (void *)conn, wst);
- #endif
- } /* do_popenws */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ppolyline()
- {
- Ppoint_list pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
- readpointarray(pts.num_points, pts.points);
- ppolyline(&pts);
- free(pts.points);
- } /* do_ppolyline */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ppolyline3()
- {
- Ppoint_list3 pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
- readpoint3array(pts.num_points, pts.points);
- ppolyline3(&pts);
- free(pts.points);
- } /* do_ppolyline3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ppolymarker()
- {
- Ppoint_list pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint *)calloc(pts.num_points, sizeof(Ppoint));
- readpointarray(pts.num_points, pts.points);
- ppolymarker(&pts);
- free(pts.points);
- } /* do_ppolymarker */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ppolymarker3()
- {
- Ppoint_list3 pts;
-
- pts.num_points = readposinteger("number of points ? ");
- pts.points = (Ppoint3 *)calloc(pts.num_points, sizeof(Ppoint3));
- readpoint3array(pts.num_points, pts.points);
- ppolymarker3(&pts);
- free(pts.points);
- } /* do_ppolymarker3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ppoststruct()
- {
- Pint ws_no, s_name;
- Pfloat pri;
-
- ws_no = readinteger("workstation identifier ? ");
- s_name = readintvalue("structure identifier ? ", PTKESTRUCTID);
- pri = readreal("priority ? ");
- ppost_struct(ws_no, s_name, pri);
- } /* do_ppoststruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preadmf()
- {
- phintererror(1, (char *)NULL, INFORM);
- } /* do_preadmf */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_predrawallstruct()
- {
- Pint wsid;
- Pctrl_flag controlflag;
-
- wsid = readinteger("workstation identifier ? ");
- controlflag = readphigsenum(PTKECONTROL, "control flag ? ");
- predraw_all_structs(wsid, controlflag);
- } /* do_predrawallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_premovenameset()
- {
- Pint_list remset;
-
- readintlst(&remset, "name set", PTKENAME);
- premove_names_set(&remset);
- free(remset.ints);
- } /* do_premovenameset */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqchoice()
- {
- Pint wsid, dev, choice;
- Pin_status status;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("choice device number ? ");
- preq_choice(wsid, dev, &status, &choice);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "choice = ");
- writeinteger(PTKEINFORM, choice);
- }
- }
- } /* do_preqchoice */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqloc()
- {
- Pint wsid, dev, view_index;
- Pin_status status;
- Ppoint pos;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- preq_loc(wsid, dev, &status, &view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint(PTKEINFORM, &pos);
- }
- }
- } /* do_preqloc */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqloc3()
- {
- Pint wsid, dev, view_index;
- Pin_status status;
- Ppoint3 pos;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- preq_loc3(wsid, dev, &status, &view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint3(PTKEINFORM, &pos);
- }
- }
- } /* do_preqloc3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqpick()
- {
- Pint wsid, dev, depth;
- Pin_status status;
- Ppick_path pick;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("pick device number ? ");
- depth = readposinteger("pick path depth ? ");
- pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
- preq_pick(wsid, dev, depth, &status, &pick);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "pick path:\n");
- writepickpath(PTKEINFORM, &pick);
- }
- }
- free(pick.path_list);
- } /* do_preqpick */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqstring()
- {
- Pint wsid, dev, size;
- Pin_status status;
- char string[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("string device number ? ");
- preq_string(wsid, dev, &status, string);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- phinprintf(PTKEINFORM, "string = \"%s\"\n", string);
- }
- } /* do_preqstring */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqstroke()
- {
- Pint wsid, dev, size, view_index;
- Pin_status status;
- Ppoint_list stroke;
- Ppoint pts[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- stroke.points = pts;
- preq_stroke(wsid, dev, &status, &view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
- }
- }
- } /* do_preqstroke */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqstroke3()
- {
- Pint wsid, dev, size, view_index;
- Pin_status status;
- Ppoint_list3 stroke;
- Ppoint3 pts[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- stroke.points = pts;
- preq_stroke3(wsid, dev, &status, &view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray3(PTKEINFORM, stroke.num_points, stroke.points);
- }
- }
- } /* do_preqstroke3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_preqval()
- {
- Pint wsid, dev;
- Pin_status status;
- Pfloat val;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("valuator device number ? ");
- preq_val(wsid, dev, &status, &val);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "value = ");
- writereal(PTKEINFORM, val);
- }
- }
- } /* do_preqval */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_prestoremodelclipvolume()
- {
- prestore_model_clip_vol();
- } /* do_prestoremodelclipvolume */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrieveallstruct()
- {
- pret_all_structs(readinteger("archive identifier ? "));
- } /* do_pretrieveallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrieveancesstruct()
- {
- Pint arid, stid, depth, err, status, i, j;
- Ppath_order order;
- Pelem_ref_list_list *paths;
- Pstore store;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- arid = readinteger("archive identifier ? ");
- stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
- order = readphigsenum(PTKEPATHORDER, "path order ? ");
- depth = readposinteger("path depth ? ");
- pcreate_store(&err, &store);
- pret_paths_ances(arid, stid, order, depth, store, &paths, &status);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (status == 0)
- {
- phinprintf(PTKEINFORM, "ancestor paths of structure %d are:\n", stid);
- for (i = 0; i < paths->num_elem_ref_lists; i++)
- {
- phinprintf(PTKEINFORM, "path %d:\n", i);
- for (j = 0; j < paths->elem_ref_lists[i].num_elem_refs; j++)
- {
- phinprintf(PTKEINFORM, "structure identifier = ");
- writeintvalue(PTKEINFORM,
- paths->elem_ref_lists[i].elem_refs[j].struct_id,
- PTKESTRUCTID);
- phinprintf(PTKEINFORM, "element number = ");
- writeinteger(PTKEINFORM,
- paths->elem_ref_lists[i].elem_refs[j].elem_pos);
- }
- }
- }
- else
- phigserror(PTKEINFORM, err);
- }
- ptk_delstore(store);
- #endif
- } /* do_pretrieveancesstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrievedescstruct()
- {
- Pint arid, stid, depth, err, status, i, j;
- Ppath_order order;
- Pelem_ref_list_list *paths;
- Pstore store;
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- arid = readinteger("archive identifier ? ");
- stid = readintvalue("structure identifier ? ", PTKESTRUCTID);
- order = readphigsenum(PTKEPATHORDER, "path order ? ");
- depth = readposinteger("path depth ? ");
- pcreate_store(&err, &store);
- pret_paths_descs(arid, stid, order, depth, store, &paths, &status);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (status == 0)
- {
- phinprintf(PTKEINFORM, "descendant paths of structure %d are:\n", stid);
- for (i = 0; i < paths->num_elem_ref_lists; i++)
- {
- phinprintf(PTKEINFORM, "path %d:\n", i);
- for (j = 0; j < paths->elem_ref_lists[i].num_elem_refs; j++)
- {
- phinprintf(PTKEINFORM, "structure identifier = ");
- writeintvalue(PTKEINFORM,
- paths->elem_ref_lists[i].elem_refs[j].struct_id,
- PTKESTRUCTID);
- phinprintf(PTKEINFORM, "element number = ");
- phinprintf(PTKEINFORM,
- paths->elem_ref_lists[i].elem_refs[j].elem_pos, "element");
- }
- }
- }
- else
- phigserror(PTKEINFORM, err);
- }
- ptk_delstore(store);
- #endif
- } /* do_pretrievedescstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrievestructids()
- {
- Pint arid, start, totlength;
- Pint_list ids;
-
- arid = readinteger("archive identifier ? ");
- start = readposinteger("starting position ? ");
- pret_struct_ids(arid, 0, start, &ids, &totlength);
- ids.ints = (Pint *)calloc(totlength, sizeof(Pint));
- ids.num_ints = totlength;
- pret_struct_ids(arid, totlength, start, &ids, &totlength);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "structure identifiers:\n");
- writeintlst(PTKEINFORM, &ids, PTKESTRUCTID);
- }
- free(ids.ints);
- } /* do_pretrievestructids */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrievestruct()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[30];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier? ");
- sns.num_ints = readposinteger("number of structures to retrieve? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- pret_structs(libid, &sns);
- free(sns.ints);
- #endif
- } /* do_pretrievestruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pretrievestructnet()
- {
- Pint i, libid;
- Pint_list sns;
- char prom[30];
-
- #ifdef HP
- phintererror(1, (char *)NULL, INFORM);
- #else
- libid = readinteger("archive identifier ? ");
- sns.num_ints = readposinteger("number of structure networks to retrieve? ");
- sns.ints = (Pint *)calloc(sns.num_ints, sizeof(Pint));
- for (i = 0; i < sns.num_ints; i++)
- {
- sprintf(prom, "root structure identifier [%d] ? ", i);
- sns.ints[i] = readintvalue(prom, PTKESTRUCTID);
- }
- pret_struct_nets(libid, &sns);
- #endif
- } /* do_pretrievestructnet */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_protate()
- {
- Pfloat angle;
- Pint err;
-
- angle = readreal("angle ? ");
- protate(angle, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_protate */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_protatex()
- {
- Pfloat angle;
- Pint err;
-
- angle = readreal("angle ? ");
- protate_x(angle, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_protatex */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_protatey()
- {
- Pfloat angle;
- Pint err;
-
- angle = readreal("angle ? ");
- protate_y(angle, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_protatey */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_protatez()
- {
- Pfloat angle;
- Pint err;
-
- angle = readreal("angle ? ");
- protate_z(angle, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_protatez */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psamplechoice()
- {
- Pint wsid, dev, choice;
- Pin_status status;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("choice device number ? ");
- psample_choice(wsid, dev, &status, &choice);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "choice = ");
- writeinteger(PTKEINFORM, choice);
- }
- }
- } /* do_psamplechoice */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psampleloc()
- {
- Pint wsid, dev, view_index;
- Ppoint pos;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- psample_loc(wsid, dev, &view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint(PTKEINFORM, &pos);
- }
- } /* do_psampleloc */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psampleloc3()
- {
- Pint wsid, dev, view_index;
- Ppoint3 pos;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("locator device number ? ");
- psample_loc3(wsid, dev, &view_index, &pos);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "point:\n");
- writepoint3(PTKEINFORM, &pos);
- }
- } /* do_psampleloc3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psamplepick()
- {
- Pint wsid, dev, depth;
- Pin_status status;
- Ppick_path pick;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("pick device number ? ");
- depth = readposinteger("pick path depth ? ");
- pick.path_list = (Ppick_path_elem *)calloc(depth, sizeof(Ppick_path_elem));
- pick.depth = depth;
- psample_pick(wsid, dev, depth, &status, &pick);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "status of request = ");
- writephigsenum(PTKEINFORM, PTKEISTATUS, status);
- if (status == PIN_STATUS_OK)
- {
- phinprintf(PTKEINFORM, "pick path:\n");
- writepickpath(PTKEINFORM, &pick.path_list);
- }
- }
- free(pick.path_list);
- } /* do_psamplepick */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psamplestring()
- {
- Pint wsid, dev, size;
- char string[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("string device number ? ");
- psample_string(wsid, dev, string);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "string = \"%s\"\n", string);
- }
- } /* do_psamplestring */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psamplestroke()
- {
- Pint wsid, dev, size, view_index;
- Ppoint_list stroke;
- Ppoint pts[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- stroke.points = pts;
- psample_stroke(wsid, dev, &view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray(PTKEINFORM, stroke.num_points, stroke.points);
- }
- } /* do_psamplestroke */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psamplestroke3()
- {
- Pint wsid, dev, size, view_index;
- Ppoint_list3 stroke;
- Ppoint3 pts[255];
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("stroke device number ? ");
- stroke.points = pts;
- psample_stroke3(wsid, dev, &view_index, &stroke);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "view index = ");
- writeintvalue(PTKEINFORM, view_index, PTKEVIEWIND);
- phinprintf(PTKEINFORM, "number of points = ");
- writeinteger(PTKEINFORM, stroke.num_points);
- phinprintf(PTKEINFORM, "points:\n");
- writepointarray3(PTKEINFORM, stroke.num_points, stroke.points);
- }
- } /* do_psamplestroke3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_psampleval()
- {
- Pint wsid, dev;
- Pfloat val;
-
- wsid = readinteger("workstation identifier ? ");
- dev = readinteger("valuator device number ? ");
- psample_val(wsid, dev, &val);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- phinprintf(PTKEINFORM, "value = ");
- writereal(PTKEINFORM, val);
- }
- } /* do_psampleval */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pscale()
- {
- Pvec scale;
- Pint err;
-
- scale = readvector("scale vector");
- pscale(&scale, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pscale */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pscale3()
- {
- Pvec3 scale;
- Pint err;
-
- scale = readvector3("scale vector");
- pscale3(&scale, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_pscale3 */
-
- /*--------------------------------------------------------------------------*/
-
- #include "psetfns.c"
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptext()
- {
- Ppoint tp;
- char s[201];
-
- tp = readpoint("text origin");
- readquote(s, "text string ? ");
- ptext(&tp, s);
- } /* do_ptext */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptext3()
- {
- Ppoint3 tp;
- char s[201];
- Pvec3 td[2];
-
- tp = readpoint3("text origin");
- td[0] = readvector3("Reference point 1");
- td[1] = readvector3("Reference point 2");
- readquote(s, "text string ? ");
- ptext3(&tp, td, s);
- } /* do_ptext3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptranpt()
- {
- Ppoint pt, result;
- Pmatrix matrix;
- Pint err;
-
- pt = readpoint("point");
- readmatrix(matrix, "transformation matrix");
- ptran_point(&pt, matrix, &err, &result);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformed point:\n");
- writepoint(PTKEINFORM, &result);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_ptranpt */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptranpt3()
- {
- Ppoint3 pt, result;
- Pmatrix3 matrix;
- Pint err;
-
- pt = readpoint3("point");
- readmatrix3(matrix, "transformation matrix");
- ptran_point3(&pt, matrix, &err, &result);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformed point:\n");
- writepoint3(PTKEINFORM, &result);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_ptranpt3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptranslate()
- {
- Pvec transvector;
- Pint err;
-
- transvector = readvector("translation vector");
- ptranslate(&transvector, &err, tm);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix(PTKEINFORM, tm);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_ptranslate */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_ptranslate3()
- {
- Pvec3 transvector;
- Pint err;
-
- transvector = readvector3("translation vector");
- ptranslate3(&transvector, &err, tm3);
- if (writeinform)
- {
- phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist[activefunction]);
- if (err == 0)
- {
- phinprintf(PTKEINFORM, "transformation matrix:\n");
- writematrix3(PTKEINFORM, tm3);
- }
- else
- phigserror(PTKEINFORM, err);
- }
- } /* do_ptranslate3 */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_punpostallstruct()
- {
- Pint wsid;
-
- wsid = readinteger("workstation identifier ? ");
- punpost_all_structs(wsid);
- } /* do_punpostallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_punpoststruct()
- {
- Pint ws_no, s_name;
-
- ws_no = readinteger("workstation identifier ? ");
- s_name = readintvalue("structure identifier ? ", PTKESTRUCTID);
- punpost_struct(ws_no, s_name);
- } /* do_punpoststruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pupdatews()
- {
- Pint wsid;
- Pregen_flag reg;
-
- wsid = readinteger("workstation identifier ? ");
- reg = readphigsenum(PTKEREGEN, "regeneration flag ? ");
- pupd_ws(wsid, reg);
- } /* do_pupdatews */
-
- /*--------------------------------------------------------------------------*/
-
- static void do_pwritemf()
- {
- phintererror(1, (char *)NULL, INFORM);
- } /* do_pwritemf */
-
- /*--------------------------------------------------------------------------*/
-
- /* PHIGS PLUS functions */
- #ifdef SUN
- #include "plusfns.c"
- #endif
-
- /*--------------------------------------------------------------------------*/
- /*------------------------- phinter functions ------------------------------*/
- /*--------------------------------------------------------------------------*/
-
- static void process_phigs_function(C(ptkephigsnames) phigsname)
- PreANSI(ptkephigsnames phigsname)
- /* This routine processes the PHIGS function whose namelist index is
- ** phigsname.
- */
- {
- /* write out the function name onto an output script if required */
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s\n", phigsnamelist[(Pint)phigsname]);
- activefunction = (Pint)phigsname;
- switch (phigsname)
- {
- case PTKEADDNAMESET: do_paddnameset();
- break;
-
- case PTKEANNOTATIONTEXTRELATIVE: do_pannotationtextrelative();
- break;
-
- case PTKEANNOTATIONTEXTRELATIVE3: do_pannotationtextrelative3();
- break;
-
- case PTKEAPPLICATIONDATA: do_papplicationdata();
- break;
-
- case PTKEARALLSTRUCT: do_parallstruct();
- break;
-
- case PTKEARSTRUCT: do_parstruct();
- break;
-
- case PTKEARSTRUCTNET: do_parstructnet();
- break;
-
- case PTKEAWAITEVENT: do_pawait_event();
- break;
-
- case PTKEBUILDTRAN: do_pbuildtran();
- break;
-
- case PTKEBUILDTRAN3: do_pbuildtran3();
- break;
-
- case PTKECELLARRAY: do_pcellarray();
- break;
-
- case PTKECELLARRAY3: do_pcellarray3();
- break;
-
- case PTKECHANGESTRUCTID: do_pchangestructid();
- break;
-
- case PTKECHANGESTRUCTIDREF: do_pchangestructidref();
- break;
-
- case PTKECHANGESTRUCTREF: do_pchangestructref();
- break;
-
- case PTKECLOSEARFILE: do_pclosearfile();
- break;
-
- case PTKECLOSEPHIGS: do_pclosephigs();
- break;
-
- case PTKECLOSESTRUCT: do_pclosestruct();
- break;
-
- case PTKECLOSEWS: do_pclosews();
- break;
-
- case PTKECOMPOSEMATRIX: do_pcomposematrix();
- break;
-
- case PTKECOMPOSEMATRIX3: do_pcomposematrix3();
- break;
-
- case PTKECOMPOSETRAN: do_pcomposetran();
- break;
-
- case PTKECOMPOSETRAN3: do_pcomposetran3();
- break;
-
- case PTKECOPYALLELEMSSTRUCT: do_pcopyallelemsstruct();
- break;
-
- case PTKEDELALLSTRUCT: do_pdelallstruct();
- break;
-
- case PTKEDELALLSTRUCTAR: do_pdelallstructar();
- break;
-
- case PTKEDELELEM: do_pdelelem();
- break;
-
- case PTKEDELELEMRANGE: do_pdelelemrange();
- break;
-
- case PTKEDELELEMSLABELS: do_pdelelemslabels();
- break;
-
- case PTKEDELSTRUCT: do_pdelstruct();
- break;
-
- case PTKEDELSTRUCTAR: do_pdelstructar();
- break;
-
- case PTKEDELSTRUCTNET: do_pdelstructnet();
- break;
-
- case PTKEDELSTRUCTNETAR: do_pdelstructnetar();
- break;
-
- case PTKEELEMSRCH: do_pelemsrch();
- break;
-
- case PTKEEMERGENCYCLOSEPHIGS: do_pemergencyclosephigs();
- break;
-
- case PTKEEMPTYSTRUCT: do_pemptystruct();
- break;
-
- case PTKEERRORHAND: do_perrorhand();
- break;
-
- case PTKEERRORLOG: do_perrorlog();
- break;
-
- case PTKEESCAPE: do_pescape();
- break;
-
- case PTKEEVALVIEWMAPPINGMATRIX: do_pevalviewmappingmatrix();
- break;
-
- case PTKEEVALVIEWMAPPINGMATRIX3: do_pevalviewmappingmatrix3();
- break;
-
- case PTKEEVALVIEWORIENTATIONMATRIX: do_pevalvieworientationmatrix();
- break;
-
- case PTKEEVALVIEWORIENTATIONMATRIX3: do_pevalvieworientationmatrix3();
- break;
-
- case PTKEEXECUTESTRUCT: do_pexecutestruct();
- break;
-
- case PTKEFILLAREA: do_pfillarea();
- break;
-
- case PTKEFILLAREA3: do_pfillarea3();
- break;
-
- case PTKEFILLAREASET: do_pfillareaset();
- break;
-
- case PTKEFILLAREASET3: do_pfillareaset3();
- break;
-
- case PTKEFLUSHEVENTS: do_pflush_events();
- break;
-
- case PTKEGDP: do_pgdp();
- break;
-
- case PTKEGDP3: do_pgdp3();
- break;
-
- case PTKEGSE: do_pgse();
- break;
-
- case PTKEGETCHOICE: do_pget_choice();
- break;
-
- case PTKEGETTYPEMF: do_pgettypemf();
- break;
-
- case PTKEGETLOC: do_pget_loc();
- break;
-
- case PTKEGETLOC3: do_pget_loc3();
- break;
-
- case PTKEGETPICK: do_pget_pick();
- break;
-
- case PTKEGETSTRING: do_pget_string();
- break;
-
- case PTKEGETSTROKE: do_pget_stroke();
- break;
-
- case PTKEGETSTROKE3: do_pget_stroke3();
- break;
-
- case PTKEGETVAL: do_pget_val();
- break;
-
- case PTKEINCRSPASRCH: do_pincrspasrch();
- break;
-
- case PTKEINCRSPASRCH3: do_pincrspasrch3();
- break;
-
- case PTKEINITCHOICE: do_pinit_choice();
- break;
-
- case PTKEINITCHOICE3: do_pinit_choice3();
- break;
-
- case PTKEINITLOC: do_pinit_loc();
- break;
-
- case PTKEINITLOC3: do_pinit_loc3();
- break;
-
- case PTKEINITPICK: do_pinit_pick();
- break;
-
- case PTKEINITPICK3: do_pinit_pick3();
- break;
-
- case PTKEINITSTRING: do_pinit_string();
- break;
-
- case PTKEINITSTRING3: do_pinit_string3();
- break;
-
- case PTKEINITSTROKE: do_pinit_stroke();
- break;
-
- case PTKEINITSTROKE3: do_pinit_stroke3();
- break;
-
- case PTKEINITVAL: do_pinit_val();
- break;
-
- case PTKEINITVAL3: do_pinit_val3();
- break;
-
- case PTKEINQANCESSTRUCT: do_pinq_paths_ances();
- break;
-
- case PTKEINQANNOTATIONFACIL: do_pinq_anno_facs();
- break;
-
- case PTKEINQARFILES: do_pinq_ar_files();
- break;
-
- case PTKEINQARST: do_pinq_ar_st();
- break;
-
- case PTKEINQCHOICEST: do_pinq_choice_st();
- break;
-
- case PTKEINQCHOICEST3: do_pinq_choice_st3();
- break;
-
- case PTKEINQCOLOURFACIL: do_pinq_colr_facs();
- break;
-
- case PTKEINQCOLOURMODEL: do_pinq_colr_model();
- break;
-
- case PTKEINQCOLOURMODELFACIL: do_pinq_colr_model_facs();
- break;
-
- case PTKEINQCOLOURREP: do_pinq_colr_rep();
- break;
-
- case PTKEINQCONFRES: do_pinq_conf_res();
- break;
-
- case PTKEINQALLCONFSTRUCT: do_pinq_all_conf_structs();
- break;
-
- case PTKEINQCONFSTRUCTINNET: do_pinq_conf_structs_net();
- break;
-
- case PTKEINQCURELEMCONTENT: do_pinq_cur_elem_content();
- break;
-
- case PTKEINQCURELEMTYPESIZE: do_pinq_cur_elem_type_size();
- break;
-
- case PTKEINQDEFCHOICEDATA: do_pinq_def_choice_data();
- break;
-
- case PTKEINQDEFCHOICEDATA3: do_pinq_def_choice_data3();
- break;
-
- case PTKEINQDEFDISPLAYUPDATEST: do_pinq_def_disp_upd_st();
- break;
-
- case PTKEINQDEFLOCDATA: do_pinq_def_loc_data();
- break;
-
- case PTKEINQDEFLOCDATA3: do_pinq_def_loc_data3();
- break;
-
- case PTKEINQDEFPICKDATA: do_pinq_def_pick_data();
- break;
-
- case PTKEINQDEFPICKDATA3: do_pinq_def_pick_data3();
- break;
-
- case PTKEINQDEFSTRINGDATA: do_pinq_def_string_data();
- break;
-
- case PTKEINQDEFSTRINGDATA3: do_pinq_def_string_data3();
- break;
-
- case PTKEINQDEFSTROKEDATA: do_pinq_def_stroke_data();
- break;
-
- case PTKEINQDEFSTROKEDATA3: do_pinq_def_stroke_data3();
- break;
-
- case PTKEINQDEFVALDATA: do_pinq_def_val_data();
- break;
-
- case PTKEINQDEFVALDATA3: do_pinq_def_val_data3();
- break;
-
- case PTKEINQDESCSTRUCT: do_pinq_paths_descs();
- break;
-
- case PTKEINQDISPLAYSPACESIZE: do_pinqdisplayspacesize();
- break;
-
- case PTKEINQDISPLAYSPACESIZE3: do_pinqdisplayspacesize3();
- break;
-
- case PTKEINQDISPLAYUPDATEST: do_pinqdisplayupdatest();
- break;
-
- case PTKEINQDYNSTRUCT: do_pinqdynstruct();
- break;
-
- case PTKEINQDYNWSATTR: do_pinqdynwsattr();
- break;
-
- case PTKEINQEDGEFACIL: do_pinqedgefacil();
- break;
-
- case PTKEINQEDGEREP: do_pinqedgerep();
- break;
-
- case PTKEINQEDITMODE: do_pinqeditmode();
- break;
-
- case PTKEINQELEMCONTENT: do_pinqelemcontent();
- break;
-
- case PTKEINQELEMPTR: do_pinqelemptr();
- break;
-
- case PTKEINQELEMTYPESIZE: do_pinqelemtypesize();
- break;
-
- case PTKEINQERRORHANDMODE: do_pinqerrorhandmode();
- break;
-
- case PTKEINQGDP: do_pinqgdp();
- break;
-
- case PTKEINQGDP3: do_pinqgdp3();
- break;
-
- case PTKEINQGSEFACIL: do_pinqgsefacil();
- break;
-
- case PTKEINQHILIGHTFILTER: do_pinqhilightfilter();
- break;
-
- case PTKEINQHLHSRFACIL: do_pinqhlhsrfacil();
- break;
-
- case PTKEINQHLHSRMODE: do_pinqhlhsrmode();
- break;
-
- case PTKEINQINPUTOVERFLOW: do_pinqinputoverflow();
- break;
-
- case PTKEINQINTFACIL: do_pinqintfacil();
- break;
-
- case PTKEINQINTREP: do_pinqintrep();
- break;
-
- case PTKEINQINVISFILTER: do_pinqinvisfilter();
- break;
-
- case PTKEINQAVAILGDP: do_pinqavailgdp();
- break;
-
- case PTKEINQAVAILGDP3: do_pinqavailgdp3();
- break;
-
- case PTKEINQGSE: do_pinqgse();
- break;
-
- case PTKEINQWSTYPES: do_pinqwstypes();
- break;
-
- case PTKEINQCOLOURIND: do_pinqcolourind();
- break;
-
- case PTKEINQEDGEIND: do_pinqedgeind();
- break;
-
- case PTKEINQINTIND: do_pinqintind();
- break;
-
- case PTKEINQPATIND: do_pinqpatind();
- break;
-
- case PTKEINQLINEIND: do_pinqlineind();
- break;
-
- case PTKEINQMARKERIND: do_pinqmarkerind();
- break;
-
- case PTKEINQTEXTIND: do_pinqtextind();
- break;
-
- case PTKEINQVIEWIND: do_pinqviewind();
- break;
-
- case PTKEINQLINEFACIL: do_pinqlinefacil();
- break;
-
- case PTKEINQLINEREP: do_pinqlinerep();
- break;
-
- case PTKEINQLOCST: do_pinqlocst();
- break;
-
- case PTKEINQLOCST3: do_pinqlocst3();
- break;
-
- case PTKEINQMODELCLIPFACIL: do_pinqmodelclipfacil();
- break;
-
- case PTKEINQMARKERFACIL: do_pinqmarkerfacil();
- break;
-
- case PTKEINQMARKERREP: do_pinqmarkerrep();
- break;
-
- case PTKEINQMOREEVENTS: do_pinqmoreevents();
- break;
-
- case PTKEINQNUMINPUT: do_pinqnuminput();
- break;
-
- case PTKEINQNUMDISPLAYPRI: do_pinqnumdisplaypri();
- break;
-
- case PTKEINQOPENSTRUCT: do_pinqopenstruct();
- break;
-
- case PTKEINQPATFACIL: do_pinqpatfacil();
- break;
-
- case PTKEINQPATREP: do_pinqpatrep();
- break;
-
- case PTKEINQPHIGSFACIL: do_pinqphigsfacil();
- break;
-
- case PTKEINQPICKST: do_pinqpickst();
- break;
-
- case PTKEINQPICKST3: do_pinqpickst3();
- break;
-
- case PTKEINQPOSTEDSTRUCT: do_pinqpostedstruct();
- break;
-
- case PTKEINQPREDCOLOURREP: do_pinqpredcolourrep();
- break;
-
- case PTKEINQPREDEDGEREP: do_pinqprededgerep();
- break;
-
- case PTKEINQPREDINTREP: do_pinqpredintrep();
- break;
-
- case PTKEINQPREDPATREP: do_pinqpredpatrep();
- break;
-
- case PTKEINQPREDLINEREP: do_pinqpredlinerep();
- break;
-
- case PTKEINQPREDMARKERREP: do_pinqpredmarkerrep();
- break;
-
- case PTKEINQPREDTEXTREP: do_pinqpredtextrep();
- break;
-
- case PTKEINQPREDVIEWREP: do_pinqpredviewrep();
- break;
-
- case PTKEINQSETOPENWS: do_pinqsetopenws();
- break;
-
- case PTKEINQSTRINGST: do_pinqstringst();
- break;
-
- case PTKEINQSTRINGST3: do_pinqstringst3();
- break;
-
- case PTKEINQSTROKEST: do_pinqstrokest();
- break;
-
- case PTKEINQSTROKEST3: do_pinqstrokest3();
- break;
-
- case PTKEINQSTRUCTIDS: do_pinqstructids();
- break;
-
- case PTKEINQSTRUCTST: do_pinqstructst();
- break;
-
- case PTKEINQSTRUCTSTATUS: do_pinqstructstatus();
- break;
-
- case PTKEINQSYSTEMST: do_pinqsystemst();
- break;
-
- case PTKEINQTEXTEXTENT: do_pinqtextextent();
- break;
-
- case PTKEINQTEXTFACIL: do_pinqtextfacil();
- break;
-
- case PTKEINQTEXTREP: do_pinqtextrep();
- break;
-
- case PTKEINQVALST: do_pinqvalst();
- break;
-
- case PTKEINQVALST3: do_pinqvalst3();
- break;
-
- case PTKEINQVIEWFACIL: do_pinqviewfacil();
- break;
-
- case PTKEINQVIEWREP: do_pinqviewrep();
- break;
-
- case PTKEINQWSCATEGORY: do_pinqwscategory();
- break;
-
- case PTKEINQWSCLASS: do_pinqwsclass();
- break;
-
- case PTKEINQWSCONNTYPE: do_pinqwsconntype();
- break;
-
- case PTKEINQSETWSPOSTED: do_pinqsetwsposted();
- break;
-
- case PTKEINQWSST: do_pinqwsst();
- break;
-
- case PTKEINQWSSTTABLE: do_pinqwssttable();
- break;
-
- case PTKEINQWSTRAN: do_pinqwstran();
- break;
-
- case PTKEINQWSTRAN3: do_pinqwstran3();
- break;
-
- case PTKEINTERPRET: do_pinterpret();
- break;
-
- case PTKELABEL: do_plabel();
- break;
-
- case PTKEMESSAGE: do_pmessage();
- break;
-
- case PTKEOFFSETELEMPTR: do_poffsetelemptr();
- break;
-
- case PTKEOPENARFILE: do_popenarfile();
- break;
-
- case PTKEOPENPHIGS: do_popenphigs();
- break;
-
- case PTKEOPENSTRUCT: do_popenstruct();
- break;
-
- case PTKEOPENWS: do_popenws();
- break;
-
- case PTKEPOLYLINE: do_ppolyline();
- break;
-
- case PTKEPOLYLINE3: do_ppolyline3();
- break;
-
- case PTKEPOLYMARKER: do_ppolymarker();
- break;
-
- case PTKEPOLYMARKER3: do_ppolymarker3();
- break;
-
- case PTKEPOSTSTRUCT: do_ppoststruct();
- break;
-
- case PTKEREADMF: do_preadmf();
- break;
-
- case PTKEREDRAWALLSTRUCT: do_predrawallstruct();
- break;
-
- case PTKEREMOVENAMESET: do_premovenameset();
- break;
-
- case PTKEREQCHOICE: do_preqchoice();
- break;
-
- case PTKEREQLOC: do_preqloc();
- break;
-
- case PTKEREQLOC3: do_preqloc3();
- break;
-
- case PTKEREQPICK: do_preqpick();
- break;
-
- case PTKEREQSTRING: do_preqstring();
- break;
-
- case PTKEREQSTROKE: do_preqstroke();
- break;
-
- case PTKEREQSTROKE3: do_preqstroke3();
- break;
-
- case PTKEREQVAL: do_preqval();
- break;
-
- case PTKERESTOREMODELCLIPVOLUME: do_prestoremodelclipvolume();
- break;
-
- case PTKERETRIEVEALLSTRUCT: do_pretrieveallstruct();
- break;
-
- case PTKERETRIEVEANCESSTRUCT: do_pretrieveancesstruct();
- break;
-
- case PTKERETRIEVEDESCSTRUCT: do_pretrievedescstruct();
- break;
-
- case PTKERETRIEVESTRUCTIDS: do_pretrievestructids();
- break;
-
- case PTKERETRIEVESTRUCT: do_pretrievestruct();
- break;
-
- case PTKERETRIEVESTRUCTNET: do_pretrievestructnet();
- break;
-
- case PTKEROTATE: do_protate();
- break;
-
- case PTKEROTATEX: do_protatex();
- break;
-
- case PTKEROTATEY: do_protatey();
- break;
-
- case PTKEROTATEZ: do_protatez();
- break;
-
- case PTKESAMPLECHOICE: do_psamplechoice();
- break;
-
- case PTKESAMPLELOC: do_psampleloc();
- break;
-
- case PTKESAMPLELOC3: do_psampleloc3();
- break;
-
- case PTKESAMPLEPICK: do_psamplepick();
- break;
-
- case PTKESAMPLESTRING: do_psamplestring();
- break;
-
- case PTKESAMPLESTROKE: do_psamplestroke();
- break;
-
- case PTKESAMPLESTROKE3: do_psamplestroke3();
- break;
-
- case PTKESAMPLEVAL: do_psampleval();
- break;
-
- case PTKESCALE: do_pscale();
- break;
-
- case PTKESCALE3: do_pscale3();
- break;
-
- case PTKESETANNOTATIONALIGN: do_psetannotationalign();
- break;
-
- case PTKESETANNOTATIONCHARHEIGHT: do_psetannotationcharheight();
- break;
-
- case PTKESETANNOTATIONCHARUP: do_psetannotationcharup();
- break;
-
- case PTKESETANNOTATIONPATH: do_psetannotationpath();
- break;
-
- case PTKESETANNOTATIONSTYLE: do_psetannotationstyle();
- break;
-
- case PTKESETCHAREXPAN: do_psetcharexpan();
- break;
-
- case PTKESETCHARHEIGHT: do_psetcharheight();
- break;
-
- case PTKESETCHARSPACE: do_psetcharspace();
- break;
-
- case PTKESETCHARUP: do_psetcharup();
- break;
-
- case PTKESETCHOICEMODE: do_psetchoicemode();
- break;
-
- case PTKESETCOLOURMODEL: do_psetcolourmodel();
- break;
-
- case PTKESETCOLOURREP: do_psetcolourrep();
- break;
-
- case PTKESETCONFRES: do_psetconfres();
- break;
-
- case PTKESETDISPLAYUPDATEST: do_psetdisplayupdatest();
- break;
-
- case PTKESETEDGECOLOURIND: do_psetedgecolourind();
- break;
-
- case PTKESETEDGEFLAG: do_psetedgeflag();
- break;
-
- case PTKESETEDGEIND: do_psetedgeind();
- break;
-
- case PTKESETEDGEREP: do_psetedgerep();
- break;
-
- case PTKESETEDGEWIDTH: do_psetedgewidth();
- break;
-
- case PTKESETEDGETYPE: do_psetedgetype();
- break;
-
- case PTKESETEDITMODE: do_pseteditmode();
- break;
-
- case PTKESETELEMPTR: do_psetelemptr();
- break;
-
- case PTKESETELEMPTRLABEL: do_psetelemptrlabel();
- break;
-
- case PTKESETERRORHANDMODE: do_pseterrorhandmode();
- break;
-
- case PTKESETGLOBALTRAN: do_psetglobaltran();
- break;
-
- case PTKESETGLOBALTRAN3: do_psetglobaltran3();
- break;
-
- case PTKESETHLHSRID: do_psethlhsrid();
- break;
-
- case PTKESETHLHSRMODE: do_psethlhsrmode();
- break;
-
- case PTKESETHILIGHTFILTER: do_psethilightfilter();
- break;
-
- case PTKESETINDIVASF: do_psetindivasf();
- break;
-
- case PTKESETINTCOLOURIND: do_psetintcolourind();
- break;
-
- case PTKESETINTIND: do_psetintind();
- break;
-
- case PTKESETINTREP: do_psetintrep();
- break;
-
- case PTKESETINTSTYLE: do_psetintstyle();
- break;
-
- case PTKESETINTSTYLEIND: do_psetintstyleind();
- break;
-
- case PTKESETINVISFILTER: do_psetinvisfilter();
- break;
-
- case PTKESETLINECOLOURIND: do_psetlinecolourind();
- break;
-
- case PTKESETLINEWIDTH: do_psetlinewidth();
- break;
-
- case PTKESETLINETYPE: do_psetlinetype();
- break;
-
- case PTKESETLOCALTRAN: do_psetlocaltran();
- break;
-
- case PTKESETLOCALTRAN3: do_psetlocaltran3();
- break;
-
- case PTKESETLOCMODE: do_psetlocmode();
- break;
-
- case PTKESETMARKERCOLOURIND: do_psetmarkercolourind();
- break;
-
- case PTKESETMARKERSIZE: do_psetmarkersize();
- break;
-
- case PTKESETMARKERTYPE: do_psetmarkertype();
- break;
-
- case PTKESETMODELCLIPINDICATOR: do_psetmodelclipindicator();
- break;
-
- case PTKESETMODELCLIPVOLUME: do_psetmodelclipvolume();
- break;
-
- case PTKESETMODELCLIPVOLUME3: do_psetmodelclipvolume3();
- break;
-
- case PTKESETPATREFPT: do_psetpatrefpt();
- break;
-
- case PTKESETPATREFPTVECTORS: do_psetpatrefptvectors();
- break;
-
- case PTKESETPATREP: do_psetpatrep();
- break;
-
- case PTKESETPATSIZE: do_psetpatsize();
- break;
-
- case PTKESETPICKFILTER: do_psetpickfilter();
- break;
-
- case PTKESETPICKID: do_psetpickid();
- break;
-
- case PTKESETPICKMODE: do_psetpickmode();
- break;
-
- case PTKESETLINEIND: do_psetlineind();
- break;
-
- case PTKESETLINEREP: do_psetlinerep();
- break;
-
- case PTKESETMARKERIND: do_psetmarkerind();
- break;
-
- case PTKESETMARKERREP: do_psetmarkerrep();
- break;
-
- case PTKESETSTRINGMODE: do_psetstringmode();
- break;
-
- case PTKESETSTROKEMODE: do_psetstrokemode();
- break;
-
- case PTKESETTEXTALIGN: do_psettextalign();
- break;
-
- case PTKESETTEXTCOLOURIND: do_psettextcolourind();
- break;
-
- case PTKESETTEXTFONT: do_psettextfont();
- break;
-
- case PTKESETTEXTIND: do_psettextind();
- break;
-
- case PTKESETTEXTPATH: do_psettextpath();
- break;
-
- case PTKESETTEXTPREC: do_psettextprec();
- break;
-
- case PTKESETTEXTREP: do_psettextrep();
- break;
-
- case PTKESETVALMODE: do_psetvalmode();
- break;
-
- case PTKESETVIEWIND: do_psetviewind();
- break;
-
- case PTKESETVIEWREP: do_psetviewrep();
- break;
-
- case PTKESETVIEWREP3: do_psetviewrep3();
- break;
-
- case PTKESETVIEWTRANINPUTPRI: do_psetviewtraninputpri();
- break;
-
- case PTKESETWSVIEWPORT: do_psetwsviewport();
- break;
-
- case PTKESETWSVIEWPORT3: do_psetwsviewport3();
- break;
-
- case PTKESETWSWINDOW: do_psetwswindow();
- break;
-
- case PTKESETWSWINDOW3: do_psetwswindow3();
- break;
-
- case PTKETEXT: do_ptext();
- break;
-
- case PTKETEXT3: do_ptext3();
- break;
-
- case PTKETRANPT: do_ptranpt();
- break;
-
- case PTKETRANPT3: do_ptranpt3();
- break;
-
- case PTKETRANSLATE: do_ptranslate();
- break;
-
- case PTKETRANSLATE3: do_ptranslate3();
- break;
-
- case PTKEUNPOSTALLSTRUCT: do_punpostallstruct();
- break;
-
- case PTKEUNPOSTSTRUCT: do_punpoststruct();
- break;
-
- case PTKEUPDATEWS: do_pupdatews();
- break;
-
- case PTKEWRITEMF: do_pwritemf();
- break;
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- case PTKECELLARRAY3PLUS: do_pcellarray3plus();
- break;
-
- case PTKECOMPFILLAREASETGNORM: do_pcompfillareasetgnorm();
- break;
-
- case PTKEFILLAREASETDATA: do_pfillareasetdata();
- break;
-
- case PTKEFILLAREASET3DATA: do_pfillareaset3data();
- break;
-
- case PTKEINQCOLRMAPFACS: do_pinqcolrmapfacs();
- break;
-
- case PTKEINQCOLRMAPMETHODFACS: do_pinqcolrmapmethodfacs();
- break;
-
- case PTKEINQCOLRMAPREP: do_pinqcolrmaprep();
- break;
-
- case PTKEINQCOLRMAPST: do_pinqcolrmapst();
- break;
-
- case PTKEINQCURVSURFFACS: do_pinqcurvsurffacs();
- break;
-
- case PTKEINQDATAMAPFACS: do_pinqdatamapfacs();
- break;
-
- case PTKEINQDATAMAPREP: do_pinqdatamaprep();
- break;
-
- case PTKEINQDCUEFACS: do_pinqdcuefacs();
- break;
-
- case PTKEINQDCUEREP: do_pinqdcuerep();
- break;
-
- case PTKEINQDIRECTCOLRMODELFACS: do_pinqdirectcolrmodelfacs();
- break;
-
- case PTKEINQDYNSWSATTRSPLUS: do_pinqdynswsattrsplus();
- break;
-
- case PTKEINQEDGEREPPLUS: do_pinqedgerepplus();
- break;
-
- case PTKEINQINTFACSPLUS: do_pinqintfacsplus();
- break;
-
- case PTKEINQINTREPPLUS: do_pinqintrepplus();
- break;
-
- case PTKEINQLIGHTSRCFACS: do_pinqlightsrcfacs();
- break;
-
- case PTKEINQLIGHTSRCREP: do_pinqlightsrcrep();
- break;
-
- case PTKEINQLISTCOLRMAPINDS: do_pinqlistcolrmapinds();
- break;
-
- case PTKEINQLISTDATAMAPINDS: do_pinqlistdatamapinds();
- break;
-
- case PTKEINQLISTDCUEINDS: do_pinqlistdcueinds();
- break;
-
- case PTKEINQLISTLIGHTSRCINDS: do_pinqlistlightsrcinds();
- break;
-
- case PTKEINQLISTPARAMSURFINDS: do_pinqlistparamsurfinds();
- break;
-
- case PTKEINQLISTREFLINDS: do_pinqlistreflinds();
- break;
-
- case PTKEINQPARAMSURFREP: do_pinqparamsurfrep();
- break;
-
- case PTKEINQPATREPPLUS: do_pinqpatrepplus();
- break;
-
- case PTKEINQLINEFACSPLUS: do_pinqlinefacsplus();
- break;
-
- case PTKEINQLINEREPPLUS: do_pinqlinerepplus();
- break;
-
- case PTKEINQMARKERREPPLUS: do_pinqmarkerrepplus();
- break;
-
- case PTKEINQPREDCOLRMAPREP: do_pinqpredcolrmaprep();
- break;
-
- case PTKEINQPREDDATAMAPREP: do_pinqpreddatamaprep();
- break;
-
- case PTKEINQPREDDCUEREP: do_pinqpreddcuerep();
- break;
-
- case PTKEINQPREDEDGEREPPLUS: do_pinqprededgerepplus();
- break;
-
- case PTKEINQPREDINTREPPLUS: do_pinqpredintrepplus();
- break;
-
- case PTKEINQPREDLIGHTSRCREP: do_pinqpredlightsrcrep();
- break;
-
- case PTKEINQPREDPARAMSURFREP: do_pinqpredparamsurfrep();
- break;
-
- case PTKEINQPREDPATREPPLUS: do_pinqpredpatrepplus();
- break;
-
- case PTKEINQPREDLINEREPPLUS: do_pinqpredlinerepplus();
- break;
-
- case PTKEINQPREDMARKERREPPLUS: do_pinqpredmarkerrepplus();
- break;
-
- case PTKEINQPREDREFLREP: do_pinqpredreflrep();
- break;
-
- case PTKEINQPREDTEXTREPPLUS: do_pinqpredtextrepplus();
- break;
-
- case PTKEINQREFLFACS: do_pinqreflfacs();
- break;
-
- case PTKEINQREFLREP: do_pinqreflrep();
- break;
-
- case PTKEINQRENDERINGCOLRMODELFACS: do_pinqrenderingcolrmodelfacs();
- break;
-
- case PTKEINQTEXTREPPLUS: do_pinqtextrepplus();
- break;
-
- case PTKEINQWSSTTABLEPLUS: do_pinqwssttableplus();
- break;
-
- case PTKENUNIBSPLCURV: do_pnunibsplcurv();
- break;
-
- case PTKENUNIBSPLCURVCOLR: do_pnunibsplcurvcolr();
- break;
-
- case PTKENUNIBSPLSURF: do_pnunibsplsurf();
- break;
-
- case PTKENUNIBSPLSURFDATA: do_pnunibsplsurfdata();
- break;
-
- case PTKEPOLYLINESET3DATA: do_ppolylineset3data();
- break;
-
- case PTKEQUADMESH3DATA: do_pquadmesh3data();
- break;
-
- case PTKEQUADMESHDATA: do_pquadmeshdata();
- break;
-
- case PTKESETBACKDATAMAPIND: do_psetbackdatamapind();
- break;
-
- case PTKESETBACKDATAMAPMETH: do_psetbackdatamapmeth();
- break;
-
- case PTKESETBACKINTCOLR: do_psetbackintcolr();
- break;
-
- case PTKESETBACKINTIND: do_psetbackintind();
- break;
-
- case PTKESETBACKINTSHADMETH: do_psetbackintshadmeth();
- break;
-
- case PTKESETBACKINTSTYLE: do_psetbackintstyle();
- break;
-
- case PTKESETBACKINTSTYLEIND: do_psetbackintstyleind();
- break;
-
- case PTKESETBACKREFLIND: do_psetbackreflind();
- break;
-
- case PTKESETBACKREFLMODEL: do_psetbackreflmodel();
- break;
-
- case PTKESETBACKREFLPROPS: do_psetbackreflprops();
- break;
-
- case PTKESETCOLRMAPIND: do_psetcolrmapind();
- break;
-
- case PTKESETCOLRMAPREP: do_psetcolrmaprep();
- break;
-
- case PTKESETCURVAPPROX: do_psetcurvapprox();
- break;
-
- case PTKESETDATAMAPIND: do_psetdatamapind();
- break;
-
- case PTKESETDATAMAPMETH: do_psetdatamapmeth();
- break;
-
- case PTKESETDATAMAPREP: do_psetdatamaprep();
- break;
-
- case PTKESETDCUEIND: do_psetdcueind();
- break;
-
- case PTKESETDCUEREP: do_psetdcuerep();
- break;
-
- case PTKESETEDGECOLR: do_psetedgecolr();
- break;
-
- case PTKESETEDGEREPPLUS: do_psetedgerepplus();
- break;
-
- case PTKESETFACECULLMODE: do_psetfacecullmode();
- break;
-
- case PTKESETFACEDISTINGMODE: do_psetfacedistingmode();
- break;
-
- case PTKESETINTCOLR: do_psetintcolr();
- break;
-
- case PTKESETINTREPPLUS: do_psetintrepplus();
- break;
-
- case PTKESETINTSHADMETH: do_psetintshadmeth();
- break;
-
- case PTKESETLIGHTSRCREP: do_psetlightsrcrep();
- break;
-
- case PTKESETLIGHTSRCSTATE: do_psetlightsrcstate();
- break;
-
- case PTKESETOFFILLAREASETDATA: do_psetoffillareasetdata();
- break;
-
- case PTKESETOFFILLAREASET3DATA: do_psetoffillareaset3data();
- break;
-
- case PTKESETPARAMSURFCHARACS: do_psetparamsurfcharacs();
- break;
-
- case PTKESETPARAMSURFIND: do_psetparamsurfind();
- break;
-
- case PTKESETPARAMSURFREP: do_psetparamsurfrep();
- break;
-
- case PTKESETPATREPPLUS: do_psetpatrepplus();
- break;
-
- case PTKESETLINECOLR: do_psetlinecolr();
- break;
-
- case PTKESETLINEREPPLUS: do_psetlinerepplus();
- break;
-
- case PTKESETLINESHADMETH: do_psetlineshadmeth();
- break;
-
- case PTKESETMARKERCOLR: do_psetmarkercolr();
- break;
-
- case PTKESETMARKERREPPLUS: do_psetmarkerrepplus();
- break;
-
- case PTKESETREFLIND: do_psetreflind();
- break;
-
- case PTKESETREFLMODEL: do_psetreflmodel();
- break;
-
- case PTKESETREFLPROPS: do_psetreflprops();
- break;
-
- case PTKESETREFLREP: do_psetreflrep();
- break;
-
- case PTKESETRENDERINGCOLRMODEL: do_psetrenderingcolrmodel();
- break;
-
- case PTKESETSURFAPPROX: do_psetsurfapprox();
- break;
-
- case PTKESETTEXTCOLR: do_psettextcolr();
- break;
-
- case PTKESETTEXTREPPLUS: do_psettextrepplus();
- break;
-
- case PTKETRISETDATA: do_ptrisetdata();
- break;
-
- case PTKETRISET3DATA: do_ptriset3data();
- break;
-
- case PTKETRISTRIPDATA: do_ptristripdata();
- break;
-
- case PTKETRISTRIP3DATA: do_ptristrip3dat();
- break;
-
- #endif
-
- default: phintererror(2, "function unknown.\n", INFORM);
- break;
- }
- /* finish the line on the output script, if required */
- if (writingscript)
- phinprintf(PTKEOUTPUT, "\n");
- } /* process_phigs_function */
-
- /*--------------------------------------------------------------------------*/
-
- static ptkephigsnames look_up_n(C(char *) n)
- PreANSI(char *n)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- /* Searches namelist for the name n.
- If found in the Phigs list, the index is returned.
- If not found at all, 0 is returned */
- Pint i;
- ptkboolean found;
-
- /* first look in the internal namelist */
- found = FALSE;
- i = 1;
- while (!found && i <= MAXPHIGSNAMES)
- {
- if (!strcmp(n, phigsnamelist[i - 1]))
- found = TRUE;
- else
- i++;
- }
- if (found) /* didn't find it in either list */
- return i; /* found it in phigs list */
- else
- return 0;
- } /* look_up_n */
-
- /*--------------------------------------------------------------------------*/
-
- static void process_comment_line(C(char *) l)
- PreANSI(char *l)
- /*
- ** processes a comment line of the form
- ** ! This is a comment
- ** and writes it to an output script if required.
- */
- {
- char ch, str[80], *ptr;
- Pint i;
-
- str[0] = '\0';
- ptr = strchr(l, '\n');
- if (ptr == NULL)
- ptr = strchr(l, EOF);
- if (ptr == NULL)
- {
- if (fileswitch)
- {
- i = 0;
- ch = getc(inputscript);
- while ((ch != '\n') && (ch != EOF))
- {
- str[i] = ch;
- ch = getc(inputscript);
- i++;
- }
- str[i] = '\0';
- }
- }
- else
- *ptr = '\0';
- if (writingscript)
- phinprintf(PTKEOUTPUT, "%s %s\n", l, str);
- } /* process_comment_line */
-
- /*--------------------------------------------------------------------------*/
-
- static void make_lower_case(C(char *) s)
- PreANSI(char *s)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- /* forces all characters in s to be lower case */
- Pint i, len;
-
- len = strlen(s);
- for (i = 0; i < len; i++)
- {
- if (isupper(s[i]))
- s[i] = tolower(s[i]);
- }
- } /* make_lower_case */
-
- /*--------------------------------------------------------------------------*/
-
- static void interpreter()
- /*
- ** description: There are two drastic exit labels: for faults which require
- ** that the function finish for good, jump to label 99 at this level.
- ** For other faults which mean 'finish this level of recursion', eg
- ** 'unable to open file', jump to label 90 declared in 'interpreter'.
- */
- {
- /* process the script on file 'ifn' */
- char name[201], errstr[256], defname[255]; /* extracted function name */
- ptkephigsnames phigsname; /* the namelist index of a function */
- ptkboolean quit, process;
-
- /* initialisation */
- quit = FALSE;
- process = TRUE;
- lno = 0; /* initialise the current line number */
- /* open the input script file */
-
- /* loop through the whole file, processing comment lines, null lines
- ** and function calls
- */
- while (!quit)
- {
- setjmp(PFABORT);
- phinteron = FALSE;
- /* loop */
- lno++; /* up current line number */
- if (readfunction(name))
- {
- /* Non-blank line */
- switch (name[0])
- {
-
- case EOF: quit = TRUE;
- break;
-
- case '!': process_comment_line(name);
- break;
-
- case 'q': make_lower_case(name);
- if (strcmp(name, "quit") == 0)
- {
- quit = TRUE;
- if (writingscript)
- phinprintf(PTKEOUTPUT, "quit\n");
- break;
- }
-
- case 'e': make_lower_case(name);
- if (strcmp(name, "exit") == 0)
- {
- quit = TRUE;
- if (writingscript)
- phinprintf(PTKEOUTPUT, "quit\n");
- break;
- }
-
- case 'h': make_lower_case(name);
- if (strcmp(name, "help") == 0)
- {
- phinprintf(PTKEINFORM, "This is Phinter, the PHIGS textual interpreter of the PHIGS Toolkit.\n");
- phinprintf(PTKEINFORM, "Input a PHIGS function name or quit/exit to leave Phinter.\n");
- phinprintf(PTKEINFORM, "Enter ABORT to jump out of a PHIGS function call.\n");
- phinprintf(PTKEINFORM, "Consult the PHIGS Toolkit User Guide for a complete list of PHIGS\nfunctions and enumerated types.\n");
- break;
- }
-
- case '#': make_lower_case(name);
- if ((strcmp(name, "#if") == 0) ||
- (strcmp(name, "#ifdef") == 0))
- {
- readstring(defname, "macro name");
- if (strcmp(defname, "SUN") == 0)
- #ifdef SUN
- process = TRUE;
- #endif
- #ifdef VMS
- process = FALSE;
- #endif
- #ifdef HP
- process = FALSE;
- #endif
- #ifdef PEXSI
- process = FALSE;
- #endif
- else
- if (strcmp(defname, "VMS") == 0)
- #ifdef VMS
- process = TRUE;
- #endif
- #ifdef SUN
- process = FALSE;
- #endif
- #ifdef HP
- process = FALSE;
- #endif
- #ifdef PEXSI
- process = FALSE;
- #endif
- else
- if (strcmp(defname, "HP") == 0)
- #ifdef HP
- process = TRUE;
- #endif
- #ifdef SUN
- process = FALSE;
- #endif
- #ifdef VMS
- process = FALSE;
- #endif
- #ifdef PEXSI
- process = FALSE;
- #endif
- else
- if (strcmp(defname, "PEXSI") == 0)
- #ifdef PEXSI
- process = TRUE;
- #endif
- #ifdef SUN
- process = FALSE;
- #endif
- #ifdef VMS
- process = FALSE;
- #endif
- #ifdef HP
- process = FALSE;
- #endif
- break;
- }
- else
- if (strcmp(name, "#endif") == 0)
- {
- process = TRUE;
- break;
- }
-
- default: /* looks like a function call */
- /* now look it up */
- if (process)
- {
- phinteron = TRUE;
- make_lower_case(name);
- if (substrinlist(phigsnamelist, MAXPHIGSNAMES, name,
- &phigsname))
- process_phigs_function(phigsname);
- else
- {
- /* unknown function */
- sprintf(errstr, "ignoring unknown function, %s.\n",
- name);
- phintererror(2, errstr, INFORM);
- }
- }
- break;
- }
- } /* readword test */
- if (!interactive)
- if (feof(inputscript))
- quit = TRUE;
- } /* loop */
- setjmp(POPJMP);
- } /* interpreter */
-
- /*--------------------------------------------------------------------------*/
-
- static void sayhello()
- {
- phinprintf(PTKESTDOUT, "This is phinter, version %.1f%s\n",
- (Pfloat)CURRENTVERSION, phintermessage);
- } /* sayhello */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_phinter(C(FILE *) input, C(FILE *) output, C(FILE *) inform)
- PreANSI(FILE *input)
- PreANSI(FILE *output)
- PreANSI(FILE *inform)
- /*
- ** \parambegin
- ** \param{FILE *}{input}{file pointer for input script}{IN}
- ** \param{FILE *}{output}{file pointer for output script}{OUT}
- ** \param{FILE *}{inform}{file pointer for information such as results of
- ** inquiry calls.}{OUT}
- ** \paramend
- ** \blurb{This function reads a PHIGS script from a file or from standard
- ** input. If {\tt stdin} is passed as the input file pointer then
- ** phinter becomes interactive and prompts are given for function
- ** parameters. The other file pointers are used for writing an output
- ** script and for writing data which
- ** results from inquiry calls and so on.}
- */
- {
- fileswitch = TRUE;
- inputscript = input;
- if (input == stdin)
- interactive = TRUE;
- else
- interactive = FALSE;
- outputscript = output;
- if (output == NULL)
- writingscript = FALSE;
- else
- writingscript = TRUE;
- informscript = inform;
- if (inform == NULL)
- writeinform = FALSE;
- else
- writeinform = TRUE;
- sayhello();
- interpreter();
- setjmp(EXITJMP);
- } /* ptk_phinter */
-
- /*-------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_strphinter(C(Pint) wsid, C(Plimit *) echoarea,
- C(Pint) outputterminal, C(Pint) informterminal)
- PreANSI(Pint wsid)
- PreANSI(Plimit *echoarea)
- PreANSI(Pint outputterminal)
- PreANSI(Pint informterminal)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Plimit *}{echo area}{echo area for string device}{IN}
- ** \param{Pint}{outputterminal}{terminal window identifier for writing
- ** output script to}{IN}
- ** \param{Pint}{informterminal}{terminal window identifier for writing
- ** information data}{IN}
- ** \paramend
- ** \blurb{This function redirects the input of phinter to the PHIGS string
- ** device (number 1). Strphinter is always interactive and output is directed
- ** to terminal windows instead of files so that it may be displayed in the
- ** PHIGS workstation window.}
- */
- {
- ptkewindowtype type;
- Pint err;
-
- fileswitch = FALSE;
- phinws = wsid;
- phinecho = *echoarea;
- outputterm = outputterminal;
- informterm = informterminal;
- interactive = TRUE;
- ptk_inqwindowtype(outputterm, &type, &err);
- if (type == PTKETERMINALWINDOW)
- writingscript = TRUE;
- else
- writingscript = FALSE;
- ptk_inqwindowtype(informterm, &type, &err);
- if (type == PTKETERMINALWINDOW)
- writeinform = TRUE;
- else
- writeinform = FALSE;
- sayhello();
- interpreter();
- setjmp(EXITJMP);
- } /* ptk_strphinter */
-
- /*-------------------------------------------------------------------------*/
-
- static void writestruct(C(FILE *) fileptr, C(Pint) stid)
- PreANSI(FILE *fileptr)
- PreANSI(Pint stid)
- {
- Pint numelems, i, err, size;
- char str[100];
- ptkselcontent elcont;
- Pstore store;
-
- fileswitch = TRUE;
- outputscript = fileptr;
- numelems = ptk_elemcount(stid);
- fprintf(fileptr, "open_structure ");
- if (ptk_hashtableused("structureid"))
- {
- ptk_inttostring("structureid", stid, 100, str, &size);
- if (size > 0)
- fprintf(fileptr,"\"%s\"\n", str);
- else
- fprintf(fileptr, "%d\n", stid);
- }
- else
- fprintf(fileptr, "%d\n", stid);
- for (i = 1; i <= numelems; i++)
- {
- pcreate_store(&err, &store);
- ptk_inqelemtypesizecontent(stid, i, store, &err, &elcont);
- writeelemcontent(PTKEOUTPUT, &elcont);
- ptk_delstore(store);
- }
- fprintf(fileptr, "close_structure");
- } /* writestruct */
-
- /*--------------------------------------------------------------------------*/
-
- static void writestructnet(C(FILE *) fileptr, C(Pint) stid)
- PreANSI(FILE *fileptr)
- PreANSI(Pint stid)
- {
- Pint_list stnetids;
- Pint i, totsize;
-
- ptk_inqstructnetids(stid, 0, &stnetids, &totsize);
- stnetids.ints = (Pint *)calloc(totsize, sizeof(Pint));
- ptk_inqstructnetids(stid, totsize, &stnetids, &totsize);
- for (i = 0; i < stnetids.num_ints; i++)
- {
- writestruct(fileptr, stnetids.ints[i]);
- fprintf(fileptr, "\n\n");
- }
- } /* writestructnet */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_readphinterscript(C(char *) scriptname, C(FILE *) output,
- C(FILE *) inform)
- PreANSI(char *scriptname)
- PreANSI(FILE *output)
- PreANSI(FILE *inform)
- /*
- ** \parambegin
- ** \param{char *}{scriptname}{script filename}{IN}
- ** \param{FILE *}{output}{output script file pointer}{OUT}
- ** \param{FILE *}{inform}{information script file pointer}{OUT}
- ** \paramend
- ** \blurb{This function reads a PHIGS script from the file specified
- ** by {\tt scriptname}. The file is automatically opened and closed
- ** and the function returns TRUE if a PHIGS script has been successfully
- ** read.}
- */
- {
- FILE *inputfile;
-
- inputfile = fopen(scriptname, "r");
- if (inputfile == NULL)
- return FALSE;
- rewind(inputfile);
- ptk_phinter(inputfile, output, inform);
- fclose(inputfile);
- return TRUE;
- } /* ptk_readphinterscript */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_writestruct(C(FILE *) fileptr, C(Pint_list *) stids)
- PreANSI(FILE *fileptr)
- PreANSI(Pint_list *stids)
- /*
- ** \parambegin
- ** \param{FILE *}{fileptr}{pointer to file}{OUT}
- ** \param{Pint\_list *}{stids}{structure identifier list}{IN}
- ** \paramend
- ** \blurb{This function writes the contents of a list of structures
- ** to a file. The structures are written in the PHIGS script format so that
- ** they may be read in again using {\tt ptk\_phinter}.}
- */
- {
- Pint i;
-
- if (fileptr != NULL)
- {
- for (i = 0; i < stids->num_ints; i++)
- {
- writestruct(fileptr, stids->ints[i]);
- fprintf(fileptr, "\n\n");
- }
- }
- } /* ptk_writestruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_writestructnet(C(FILE *) fileptr, C(Pint_list *) stids)
- PreANSI(FILE *fileptr)
- PreANSI(Pint_list *stids)
- /*
- ** \parambegin
- ** \param{FILE *}{fileptr}{pointer to file}{OUT}
- ** \param{Pint\_list *}{stids}{structure network identifier list}{IN}
- ** \paramend
- ** \blurb{This function writes the contents of a list of structure networks
- ** to a file. The structures are written in the PHIGS script format so that
- ** they may be read in again using {\tt ptk\_phinter}.}
- */
- {
- Pint i;
-
- if (fileptr != NULL)
- {
- for (i = 0; i < stids->num_ints; i++)
- {
- writestructnet(fileptr, stids->ints[i]);
- fprintf(fileptr, "\n\n");
- }
- }
- } /* ptk_writestructnet */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_writeallstruct(C(FILE *) fileptr)
- PreANSI(FILE *fileptr)
- /*
- ** \parambegin
- ** \param{FILE *}{fileptr}{pointer to file}{OUT}
- ** \paramend
- ** \blurb{This function writes the contents of all the structures in the
- ** PHIGS CSS to a file. The structures are written in the PHIGS script
- ** format so that they may be read in again using {\tt ptk\_phinter}.}
- */
- {
- Pint err, totlength, i;
- Pint_list stids;
-
- if (fileptr != NULL)
- {
- pinq_struct_ids(0, 0, &err, &stids, &totlength);
- stids.ints = (Pint *)calloc(totlength, sizeof(Pint));
- stids.num_ints = totlength;
- pinq_struct_ids(totlength, 0, &err, &stids, &totlength);
- for (i = 0; i < stids.num_ints; i++)
- {
- writestruct(fileptr, stids.ints[i]);
- fprintf(fileptr, "\n\n");
- }
- free(stids.ints);
- }
- } /* ptk_writeallstruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_readelem(C(Pint) ws, C(Plimit *) echoarea, C(Pelem_type) eltype)
- PreANSI(Pint ws)
- PreANSI(Plimit *echoarea)
- PreANSI(Pelem_type eltype)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Plimit *}{echo area}{echo area for string device}{IN}
- ** \param{Pelem\_type}{eltype}{element type to read in}{IN}
- ** \paramend
- ** \blurb{This function reads the contents of a PHIGS element from the
- ** PHIGS string device (number 1). Prompts are given for the required data
- ** depending on the element type. An element with the input data is inserted
- ** into the currently open structure at the current editing position.}
- */
- {
- fileswitch = FALSE;
- phinws = ws;
- phinecho = *echoarea;
- writingscript = FALSE;
- writeinform = FALSE;
- switch (eltype)
- {
- case PELEM_NIL:
- break;
-
- case PELEM_POLYLINE3: do_ppolyline3();
- break;
-
- case PELEM_POLYMARKER3: do_ppolymarker3();
- break;
-
- case PELEM_FILL_AREA3: do_pfillarea3();
- break;
-
- case PELEM_POLYLINE: do_ppolyline();
- break;
-
- case PELEM_POLYMARKER: do_ppolymarker();
- break;
-
- case PELEM_FILL_AREA: do_pfillarea();
- break;
-
- case PELEM_TEXT3: do_ptext3();
- break;
-
- case PELEM_TEXT: do_ptext();
- break;
-
- case PELEM_ANNO_TEXT_REL3: do_pannotationtextrelative3();
- break;
-
- case PELEM_ANNO_TEXT_REL: do_pannotationtextrelative();
- break;
-
- case PELEM_FILL_AREA_SET3: do_pfillareaset3();
- break;
-
- case PELEM_FILL_AREA_SET: do_pfillareaset();
- break;
-
- case PELEM_CELL_ARRAY3: do_pcellarray3();
- break;
-
- case PELEM_CELL_ARRAY: do_pcellarray();
- break;
-
- case PELEM_GDP3: do_pgdp3();
- break;
-
- case PELEM_GDP: do_pgdp();
- break;
-
- case PELEM_LINE_IND: do_psetlineind();
- break;
-
- case PELEM_MARKER_IND: do_psetmarkerind();
- break;
-
- case PELEM_TEXT_IND: do_psettextind();
- break;
-
- case PELEM_INT_IND: do_psetintind();
- break;
-
- case PELEM_EDGE_IND: do_psetedgeind();
- break;
-
- case PELEM_LINETYPE: do_psetlinetype();
- break;
-
- case PELEM_LINE_COLR_IND: do_psetlinecolourind();
- break;
-
- case PELEM_MARKER_TYPE: do_psetmarkertype();
- break;
-
- case PELEM_MARKER_COLR_IND: do_psetmarkercolourind();
- break;
-
- case PELEM_TEXT_FONT: do_psettextfont();
- break;
-
- case PELEM_TEXT_COLR_IND: do_psettextcolourind();
- break;
-
- case PELEM_ANNO_STYLE: do_psetannotationstyle();
- break;
-
- case PELEM_INT_STYLE_IND: do_psetintstyleind();
- break;
-
- case PELEM_INT_COLR_IND: do_psetintcolourind();
- break;
-
- case PELEM_EDGETYPE: do_psetedgetype();
- break;
-
- case PELEM_EDGE_COLR_IND: do_psetedgecolourind();
- break;
-
- case PELEM_HLHSR_ID: do_psethlhsrid();
- break;
-
- case PELEM_VIEW_IND: do_psetviewind();
- break;
-
- case PELEM_LABEL: do_plabel();
- break;
-
- case PELEM_PICK_ID: do_psetpickid();
- break;
-
- case PELEM_LINEWIDTH: do_psetlinewidth();
- break;
-
- case PELEM_MARKER_SIZE: do_psetmarkersize();
- break;
-
- case PELEM_CHAR_EXPAN: do_psetcharexpan();
- break;
-
- case PELEM_CHAR_SPACE: do_psetcharspace();
- break;
-
- case PELEM_CHAR_HT: do_psetcharheight();
- break;
-
- case PELEM_ANNO_CHAR_HT: do_psetannotationcharheight();
- break;
-
- case PELEM_EDGEWIDTH: do_psetedgewidth();
- break;
-
- case PELEM_EXEC_STRUCT: do_pexecutestruct();
- break;
-
- case PELEM_TEXT_PREC: do_psettextprec();
- break;
-
- case PELEM_CHAR_UP_VEC: do_psetcharup();
- break;
-
- case PELEM_ANNO_CHAR_UP_VEC: do_psetannotationcharup();
- break;
-
- case PELEM_TEXT_PATH: do_psettextpath();
- break;
-
- case PELEM_ANNO_PATH: do_psetannotationpath();
- break;
-
- case PELEM_TEXT_ALIGN: do_psettextalign();
- break;
-
- case PELEM_ANNO_ALIGN: do_psetannotationalign();
- break;
-
- case PELEM_INT_STYLE: do_psetintstyle();
- break;
-
- case PELEM_EDGE_FLAG: do_psetedgeflag();
- break;
-
- case PELEM_PAT_SIZE: do_psetpatsize();
- break;
-
- case PELEM_PAT_REF_POINT: do_psetpatrefpt();
- break;
-
- case PELEM_PAT_REF_POINT_VECS: do_psetpatrefptvectors();
- break;
-
- case PELEM_ADD_NAMES_SET: do_paddnameset();
- break;
-
- case PELEM_REMOVE_NAMES_SET: do_premovenameset();
- break;
-
- case PELEM_INDIV_ASF: do_psetindivasf();
- break;
-
- case PELEM_LOCAL_MODEL_TRAN3: do_psetlocaltran3();
- break;
-
- case PELEM_LOCAL_MODEL_TRAN: do_psetlocaltran();
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN3: do_psetglobaltran3();
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN: do_psetglobaltran();
- break;
-
- case PELEM_MODEL_CLIP_VOL3: do_psetmodelclipvolume3();
- break;
-
- case PELEM_MODEL_CLIP_VOL: do_psetmodelclipvolume();
- break;
-
- case PELEM_MODEL_CLIP_IND: do_psetmodelclipindicator();
- break;
-
- case PELEM_RESTORE_MODEL_CLIP_VOL: do_prestoremodelclipvolume();
- break;
-
- case PELEM_APPL_DATA: do_papplicationdata();
- break;
-
- case PELEM_GSE: do_pgse();
- break;
-
- }
- } /* ptk_readelem */
-
- /*--------------------------------------------------------------------------*/
-
- static void read_string(C(char *) str)
- PreANSI(char *str)
- /*
- ** description:
- ** input params:
- ** output params:
- ** return value:
- */
- {
- /* Reads a string. if the first non-blank character found is
- a double quote ("), the string is assumed to quoted, and must
- be "string", on one line. otherwise, the next sequence of
- non-blank characters will be returned as the string */
- Pint wi;
- Pint ch;
- ptkboolean finished;
-
- wi = 0;
- finished = FALSE;
- ch = getc(stdin);
- while (ch == ' ' || ch == '\n')
- ch = getc(stdin);
- while (!finished)
- {
- str[wi] = ch;
- wi++;
- if (ch == '\0')
- finished = TRUE;
- else
- if (ch == '\n' || ch == ' ')
- {
- finished = TRUE;
- wi--;
- }
- else
- ch = getc(stdin);
- }
- str[wi] = '\0';
- } /* read_string */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_callphinter(C(void))
- /*PreANSI()*/
- /*
- ** \blurb{This function provides an interface to phinter and its related
- ** functions. The available commands are as follows:
- ** \begin{description}
- ** \item[help]{output this list.}
- ** \item[interactive]{call phinter with stdin for input script.}
- ** \item[stringinput]{call phinter using string device for input
- ** and terminal windows for output.}
- ** \item[read]{call phinter with a given input script.}
- ** \item[outputfile]{set output script filename.}
- ** \item[informfile]{set information filename.}
- ** \item[outputterm]{set output terminal window identifier.}
- ** \item[informterm]{set information terminal window identifier.}
- ** \item[writestruct]{write contents of structures to output file.}
- ** \item[writestruct]{write contents of structure networks
- ** to output file.}
- ** \item[writestruct]{write contents of all structures to
- ** output file.}
- ** \item[quit or exit]{leave callphinter.}
- ** \end{description}\
- ** }
- */
- {
- FILE *f, *inf, *outf;
- Pint lencom;
- ptkboolean finished;
- char filename[255], command[30];
- Pint outterm, infterm;
-
- fileswitch = TRUE;
- finished = FALSE;
- inf = stdout;
- outf = NULL;
- while (!finished)
- {
- inputscript = stdin;
- interactive = TRUE;
- printf("callphinter> ");
- read_string(command);
- lencom = strlen(command);
- if (strncmp(command, "help", lencom) == 0)
- {
- printf("commands\n--------\n");
- printf("help -- output this list.\n");
- printf("interactive -- call phinter with stdin for input script.\n");
- printf("stringinput -- call phinter using string device for input\n");
- printf(" and terminal windows for output.\n");
- printf("read -- call phinter with a given input script.\n");
- printf("outputfile -- set output script filename.\n");
- printf("informfile -- set information filename.\n");
- printf("outputterm -- set output terminal window identifier.\n");
- printf("informterm -- set information terminal window identifier.\n");
- printf("writestruct -- write contents of structures to output file.\n");
- printf("writestructnet -- write contents of structure networks\n");
- printf(" to output file.\n");
- printf("writeallstruct -- write contents of all structures to \n");
- printf(" output file.\n");
- printf("quit or exit -- leave callphinter.\n");
- }
- else
- if (strncmp(command, "interactive", lencom) == 0)
- {
- ptk_phinter(stdin, outf, inf);
- }
- else
- if (strncmp(command, "phigs", lencom) == 0)
- {
- ptk_phinter(stdin, outf, inf);
- }
- else
- if (strncmp(command, "stringinput", lencom) == 0)
- {
- Pint ws;
- Plimit echoarea;
-
- ws = readinteger("workstation identifier");
- echoarea = readlimit("echo area");
- ptk_strphinter(ws, &echoarea, outterm, infterm);
- fileswitch = TRUE;
- }
- else
- if (strncmp(command, "read", lencom) == 0)
- {
- printf("filename > ");
- read_string(filename);
- stripstr(filename, '"');
- f = fopen(filename, "r");
- if (f == NULL)
- {
- printf("couldn't find file %s\n", filename);
- }
- else
- {
- rewind(f);
- ptk_phinter(f, outf, inf);
- fclose(f);
- }
- }
- else
- if (strncmp(command, "informfile", lencom) == 0)
- {
- FILE *tempf;
-
- printf("information filename > ");
- read_string(filename);
- stripstr(filename, '"');
- if (strncmp(filename, "stdout", 6) == 0)
- {
- if (inf != stdout)
- fclose(inf);
- inf = stdout;
- }
- else
- if (strncmp(filename, "NULL", 4) == 0)
- {
- if ((inf != stdout) && (inf != NULL))
- fclose(inf);
- inf = (FILE *)NULL;
- }
- else
- {
- tempf = fopen(filename, "w+");
- if (tempf == NULL)
- {
- printf("couldn't find file %s\n", filename);
- }
- else
- {
- if (inf != stdout)
- fclose(inf);
- inf = tempf;
- }
- }
- }
- else
- if (strncmp(command, "outputfile", lencom) == 0)
- {
- FILE *tempf;
-
- printf("output script filename > ");
- read_string(filename);
- stripstr(filename, '"');
- if (strncmp(filename, "stdout", 6) == 0)
- {
- if (outf != stdout)
- fclose(outf);
- outf = stdout;
- }
- else
- if (strncmp(filename, "NULL", 4) == 0)
- {
- if ((outf != stdout) && (outf != NULL))
- fclose(outf);
- outf = (FILE *)NULL;
- }
- else
- {
- tempf = fopen(filename, "w+");
- if (tempf == NULL)
- {
- printf("couldn't find file %s\n", filename);
- }
- else
- {
- if (outf != stdout)
- fclose(outf);
- outf = tempf;
- }
- }
- }
- else
- if (strncmp(command, "outputterm", lencom) == 0)
- {
- outterm = readinteger("output script terminal window identifier");
- }
- else
- if (strncmp(command, "informterm", lencom) == 0)
- {
- infterm = readinteger("information terminal window identifier");
- }
- else
- if (strncmp(command, "writestruct", lencom) == 0)
- {
- Pint i;
- Pint_list stids;
-
- stids.num_ints = readposinteger("number of structures");
- stids.ints = (Pint *)calloc(stids.num_ints, sizeof(Pint));
- for (i = 0; i < stids.num_ints; i++)
- stids.ints[i] = readintvalue("structure identifier", PTKESTRUCTID);
- printf("writing structures...\n");
- ptk_writestruct(outf, &stids);
- free(stids.ints);
- }
- else
- if (strncmp(command, "writestructnet", lencom) == 0)
- {
- Pint i;
- Pint_list stids;
-
- stids.num_ints = readposinteger("number of structure networks");
- stids.ints = (Pint *)calloc(stids.num_ints, sizeof(Pint));
- for (i = 0; i < stids.num_ints; i++)
- stids.ints[i] = readintvalue("root structure identifier",
- PTKESTRUCTID);
- printf("writing structure networks...\n");
- ptk_writestructnet(outf, &stids);
- free(stids.ints);
- }
- else
- if (strncmp(command, "writeallstruct", lencom) == 0)
- {
- printf("writing all structures...\n");
- ptk_writeallstruct(outf);
- }
- else
- if ((strncmp(command, "quit", lencom) == 0) ||
- (strncmp(command, "exit", lencom) == 0))
- {
- finished = TRUE;
- }
- else
- printf("Callphinter: command unknown.\n");
- }
- if (inf != stdout)
- fclose(inf);
- if (outf != stdout)
- fclose(outf);
- } /* ptk_callphinter */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_elemcontent(C(Pint) stid, C(Pint) elemid, C(Pint) termid,
- C(Pint *) error)
- PreANSI(Pint stid)
- PreANSI(Pint elemid)
- PreANSI(Pint termid)
- PreANSI(Pint *error)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{elemid}{element number}{IN}
- ** \param{Pint}{termid}{terminal window identifier}{IN}
- ** \param{PInt *}{error}{error code}{OUT}
- ** \paramend
- ** \blurb{This function writes the contents of an element in a
- ** terminal window. If the element is an output primitive then
- ** it is inserted into the currently open structure at the current
- ** editing position and the function returns TRUE, otherwise FALSE.}
- */
- {
- Pint ecount, namelen, i, numpts, err, name;
- ptkselcontent elcont;
- Pstruct_status stat;
- char elemname[50];
- ptkboolean inserted;
- Popen_struct_status structst;
- Pstore store;
-
- fileswitch = FALSE;
- outputterm = termid;
- writingscript = FALSE;
- writeinform = FALSE;
- *error = 0;
- inserted = FALSE;
- pinq_struct_status(stid, error, &stat);
- ecount = ptk_elemcount(stid);
- if (stat == PSTRUCT_STATUS_NON_EXISTENT)
- {
- *error = 1; /* structure does not exist */
- return inserted;
- }
- if ((elemid <= 0) || (elemid > ecount))
- {
- *error = 2; /* element does not exist */
- return inserted;
- }
- pcreate_store(&err, &store);
- ptk_inqelemtypesizecontent(stid, elemid, store, error, &elcont);
- /* write element content to terminal window */
- writeelemcontent(PTKEOUTPUT, &elcont);
- pinq_open_struct(&err, &structst, &name);
- /* PHIGS PLUS bits */
- if (structst == PSTRUCT_OPEN)
- {
- switch (elcont.eltype)
- {
- case PELEM_POLYLINE3:
- case PELEM_POLYMARKER3:
- case PELEM_FILL_AREA3:
- case PELEM_POLYLINE:
- case PELEM_POLYMARKER:
- case PELEM_FILL_AREA:
- case PELEM_TEXT3:
- case PELEM_TEXT:
- case PELEM_ANNO_TEXT_REL3:
- case PELEM_ANNO_TEXT_REL:
- case PELEM_FILL_AREA_SET3:
- case PELEM_FILL_AREA_SET:
- case PELEM_CELL_ARRAY3:
- case PELEM_CELL_ARRAY:
- #ifdef SUN
- case PELEM_POLYLINE_SET3_DATA:
- case PELEM_FILL_AREA_SET3_DATA:
- case PELEM_TRI_STRIP3_DATA:
- case PELEM_QUAD_MESH3_DATA:
- case PELEM_SET_OF_FILL_AREA_SET3_DATA:
- case PELEM_NUNI_BSP_CURVE:
- case PELEM_NUNI_BSP_SURF:
- case PELEM_CELL_ARRAY3_PLUS:
- #endif
- ptk_executeelem(&elcont);
- inserted = TRUE;
- break;
- }
- }
- ptk_delstore(store);
- return inserted;
- } /* ptk_elemcontent*/
-
- /*--------------------------------------------------------------------------*/
-
- /* end of phin.c */
-